mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-25 06:09:50 +00:00
Fixes on top of the clang-warn-fix commit
This commit is contained in:
parent
d4e0575d67
commit
383e225135
@ -83,61 +83,61 @@
|
||||
|
||||
static void get_modregstr (dis_buffer_t *, int, int, int, int);
|
||||
static void get_immed (dis_buffer_t *, int);
|
||||
static void get_fpustdGEN (dis_buffer_t *, u_short, const char *);
|
||||
static void get_fpustdGEN (dis_buffer_t *, ut16, const char *);
|
||||
static void addstr (dis_buffer_t *, const char *s);
|
||||
static void prints (dis_buffer_t *, int, int);
|
||||
static void printu (dis_buffer_t *, u_int, int);
|
||||
static void printu (dis_buffer_t *, ut32i, int);
|
||||
static void prints_wb (dis_buffer_t *, int, int, int);
|
||||
static void printu_wb (dis_buffer_t *, u_int, int, int);
|
||||
static void printu_wb (dis_buffer_t *, ut32i, int, int);
|
||||
static void prints_bf (dis_buffer_t *, int, int, int);
|
||||
static void printu_bf (dis_buffer_t *, u_int, int, int);
|
||||
static void printu_bf (dis_buffer_t *, ut32i, int, int);
|
||||
static void iaddstr (dis_buffer_t *, const char *s);
|
||||
//static void iprints (dis_buffer_t *, int, int);
|
||||
static void iprintu (dis_buffer_t *, u_int, int);
|
||||
static void iprintu (dis_buffer_t *, ut32i, int);
|
||||
//static void iprints_wb (dis_buffer_t *, int, int, int);
|
||||
static void iprintu_wb (dis_buffer_t *, u_int, int, int);
|
||||
static void iprintu_wb (dis_buffer_t *, ut32i, int, int);
|
||||
static void make_cond (dis_buffer_t *, int , char *);
|
||||
static void print_fcond (dis_buffer_t *, char);
|
||||
static void print_mcond (dis_buffer_t *, char);
|
||||
static void print_disp (dis_buffer_t *, int, int, int, int);
|
||||
static void print_addr (dis_buffer_t *, u_long);
|
||||
static void print_reglist (dis_buffer_t *, int, u_short);
|
||||
static void print_freglist (dis_buffer_t *, int, u_short, int);
|
||||
static void print_fcode (dis_buffer_t *, u_short);
|
||||
static void print_AxAyPredec(dis_buffer_t *, u_short);
|
||||
static void print_DxDy(dis_buffer_t *, u_short);
|
||||
static void print_RnPlus(dis_buffer_t *, u_short, int, int, int);
|
||||
static void print_addr (dis_buffer_t *, ut32);
|
||||
static void print_reglist (dis_buffer_t *, int, ut16);
|
||||
static void print_freglist (dis_buffer_t *, int, ut16, int);
|
||||
static void print_fcode (dis_buffer_t *, ut16);
|
||||
static void print_AxAyPredec(dis_buffer_t *, ut16);
|
||||
static void print_DxDy(dis_buffer_t *, ut16);
|
||||
static void print_RnPlus(dis_buffer_t *, ut16, int, int, int);
|
||||
|
||||
/* groups */
|
||||
static void opcode_bitmanip (dis_buffer_t *, u_short);
|
||||
static void opcode_move (dis_buffer_t *, u_short);
|
||||
static void opcode_misc (dis_buffer_t *, u_short);
|
||||
static void opcode_branch (dis_buffer_t *, u_short);
|
||||
static void opcode_coproc (dis_buffer_t *, u_short);
|
||||
static void opcode_0101 (dis_buffer_t *, u_short);
|
||||
static void opcode_1000 (dis_buffer_t *, u_short);
|
||||
static void opcode_addsub (dis_buffer_t *, u_short);
|
||||
static void opcode_1010 (dis_buffer_t *, u_short);
|
||||
static void opcode_1011 (dis_buffer_t *, u_short);
|
||||
static void opcode_1100 (dis_buffer_t *, u_short);
|
||||
static void opcode_1110 (dis_buffer_t *, u_short);
|
||||
static void opcode_fpu (dis_buffer_t *, u_short);
|
||||
static void opcode_mmu (dis_buffer_t *, u_short);
|
||||
static void opcode_mmu040 (dis_buffer_t *, u_short);
|
||||
static void opcode_move16 (dis_buffer_t *, u_short);
|
||||
static void opcode_bitmanip (dis_buffer_t *, ut16);
|
||||
static void opcode_move (dis_buffer_t *, ut16);
|
||||
static void opcode_misc (dis_buffer_t *, ut16);
|
||||
static void opcode_branch (dis_buffer_t *, ut16);
|
||||
static void opcode_coproc (dis_buffer_t *, ut16);
|
||||
static void opcode_0101 (dis_buffer_t *, ut16);
|
||||
static void opcode_1000 (dis_buffer_t *, ut16);
|
||||
static void opcode_addsub (dis_buffer_t *, ut16);
|
||||
static void opcode_1010 (dis_buffer_t *, ut16);
|
||||
static void opcode_1011 (dis_buffer_t *, ut16);
|
||||
static void opcode_1100 (dis_buffer_t *, ut16);
|
||||
static void opcode_1110 (dis_buffer_t *, ut16);
|
||||
static void opcode_fpu (dis_buffer_t *, ut16);
|
||||
static void opcode_mmu (dis_buffer_t *, ut16);
|
||||
static void opcode_mmu040 (dis_buffer_t *, ut16);
|
||||
static void opcode_move16 (dis_buffer_t *, ut16);
|
||||
|
||||
/* subs of groups */
|
||||
static void opcode_movec (dis_buffer_t *, u_short);
|
||||
static void opcode_divmul (dis_buffer_t *, u_short);
|
||||
static void opcode_movem (dis_buffer_t *, u_short);
|
||||
static void opcode_fmove_ext (dis_buffer_t *, u_short, u_short);
|
||||
static void opcode_pmove (dis_buffer_t *, u_short, u_short);
|
||||
static void opcode_pflush (dis_buffer_t *, u_short, u_short);
|
||||
static void opcode_movec (dis_buffer_t *, ut16);
|
||||
static void opcode_divmul (dis_buffer_t *, ut16);
|
||||
static void opcode_movem (dis_buffer_t *, ut16);
|
||||
static void opcode_fmove_ext (dis_buffer_t *, ut16, ut16);
|
||||
static void opcode_pmove (dis_buffer_t *, ut16, ut16);
|
||||
static void opcode_pflush (dis_buffer_t *, ut16, ut16);
|
||||
|
||||
#define addchar(ch) (*dbuf->casm++ = ch)
|
||||
#define iaddchar(ch) (*dbuf->cinfo++ = ch)
|
||||
|
||||
typedef void dis_func_t (dis_buffer_t *, u_short);
|
||||
typedef void dis_func_t (dis_buffer_t *, ut16);
|
||||
|
||||
static dis_func_t *const opcode_map[16] = {
|
||||
opcode_bitmanip, opcode_move, opcode_move, opcode_move,
|
||||
@ -182,22 +182,25 @@ static char asm_buffer[256];
|
||||
static char info_buffer[256];
|
||||
static int db_radix = 16;
|
||||
|
||||
static inline u_short read16(short *p) {
|
||||
return ((u_short)*(u_char *)p)<<8 | (u_short)*((u_char *)p+1);
|
||||
static inline ut16 read16(short *p) {
|
||||
return ((ut16)*(ut8 *)p)<<8 | (ut16)*((ut8 *)p+1);
|
||||
}
|
||||
|
||||
|
||||
static inline u_long read32(short *p) {
|
||||
return ((u_long)*(u_char *)p)<<24 | ((u_long)*((u_char *)p+1))<<16 |
|
||||
((u_long)*((u_char *)p+2))<<8 | (u_long)*((u_char *)p+3);
|
||||
static inline ut32 read32(short *p) {
|
||||
return ((ut32)*(ut8 *)p)<<24 | ((ut32)*((ut8 *)p+1))<<16 |
|
||||
((ut32)*((ut8 *)p+2))<<8 | (ut32)*((ut8 *)p+3);
|
||||
}
|
||||
|
||||
|
||||
#ifdef R_IPI
|
||||
#undef R_IPI
|
||||
#endif
|
||||
#define R_IPI
|
||||
R_IPI m68k_word *M68k_Disassemble(struct DisasmPara_68k *dp)
|
||||
/* Disassemble M68k instruction and return a pointer to the next */
|
||||
/* instruction, or NULL if an error occurred. */
|
||||
{
|
||||
u_short opc;
|
||||
ut16 opc;
|
||||
dis_func_t *func;
|
||||
dis_buffer_t dbuf;
|
||||
char *s;
|
||||
@ -248,10 +251,10 @@ R_IPI m68k_word *M68k_Disassemble(struct DisasmPara_68k *dp)
|
||||
/*
|
||||
* Bit manipulation/MOVEP/Immediate.
|
||||
*/
|
||||
static void opcode_bitmanip(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_bitmanip(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
char *tmp;
|
||||
u_short ext;
|
||||
ut16 ext;
|
||||
int sz;
|
||||
|
||||
tmp = NULL;
|
||||
@ -382,7 +385,7 @@ static void opcode_bitmanip(dis_buffer_t *dbuf, u_short opc)
|
||||
}
|
||||
|
||||
if (IS_INST(CAS2,opc)) {
|
||||
u_short ext2;
|
||||
ut16 ext2;
|
||||
|
||||
ext = read16(dbuf->val + 1);
|
||||
ext2 = read16(dbuf->val + 2);
|
||||
@ -554,7 +557,7 @@ static void opcode_bitmanip(dis_buffer_t *dbuf, u_short opc)
|
||||
* move byte/word/long and q
|
||||
* 00xx (01==.b 10==.l 11==.w) and 0111(Q)
|
||||
*/
|
||||
static void opcode_move(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_move(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
int sz, lused;
|
||||
|
||||
@ -600,7 +603,7 @@ static void opcode_move(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* misc opcodes.
|
||||
*/
|
||||
static void opcode_misc(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_misc(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
char *tmp;
|
||||
int sz;
|
||||
@ -824,7 +827,7 @@ static void opcode_misc(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* ADDQ/SUBQ/Scc/DBcc/TRAPcc
|
||||
*/
|
||||
static void opcode_0101(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_0101(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
int data;
|
||||
|
||||
@ -890,7 +893,7 @@ static void opcode_0101(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* Bcc/BSR/BRA
|
||||
*/
|
||||
static void opcode_branch(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_branch(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
int disp;
|
||||
|
||||
@ -921,14 +924,14 @@ static void opcode_branch(dis_buffer_t *dbuf, u_short opc)
|
||||
addchar('b');
|
||||
}
|
||||
addchar('\t');
|
||||
print_addr(dbuf, disp + (u_long)dbuf->sval + 2); /*phx - use sval */
|
||||
print_addr(dbuf, disp + (size_t)dbuf->sval + 2); /*phx - use sval */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ADD/ADDA/ADDX/SUB/SUBA/SUBX
|
||||
*/
|
||||
static void opcode_addsub(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_addsub(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
int sz, ch, amode;
|
||||
|
||||
@ -1000,10 +1003,10 @@ static void opcode_addsub(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* Shift/Rotate/Bit Field
|
||||
*/
|
||||
static void opcode_1110(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_1110(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
char *tmp;
|
||||
u_short ext;
|
||||
ut16 ext;
|
||||
int type, sz;
|
||||
|
||||
tmp = NULL;
|
||||
@ -1144,7 +1147,7 @@ static void opcode_1110(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* CMP/CMPA/EOR
|
||||
*/
|
||||
static void opcode_1011(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_1011(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
int sz;
|
||||
|
||||
@ -1221,7 +1224,7 @@ static void opcode_1011(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* OR/DIV/SBCD
|
||||
*/
|
||||
static void opcode_1000(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_1000(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
int sz;
|
||||
|
||||
@ -1294,7 +1297,7 @@ static void opcode_1000(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* AND/MUL/ABCD/EXG (1100)
|
||||
*/
|
||||
static void opcode_1100(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_1100(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
int sz;
|
||||
|
||||
@ -1363,7 +1366,7 @@ static void opcode_1100(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* Coprocessor instruction
|
||||
*/
|
||||
static void opcode_coproc(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_coproc(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
switch (BITFIELD(read16(dbuf->val),11,9)) {
|
||||
case 1:
|
||||
@ -1404,16 +1407,16 @@ static void opcode_coproc(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* Resvd
|
||||
*/
|
||||
static void opcode_1010(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_1010(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
addstr(dbuf, "linea");
|
||||
dbuf->used++;
|
||||
}
|
||||
|
||||
|
||||
static void opcode_fpu(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_fpu(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
u_short ext;
|
||||
ut16 ext;
|
||||
int type, opmode;
|
||||
|
||||
type = BITFIELD(opc,8,6);
|
||||
@ -1630,7 +1633,7 @@ static void opcode_fpu(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* XXX - This screws up on: fmovem a0@(312),fpcr/fpsr/fpi
|
||||
*/
|
||||
static void opcode_fmove_ext(dis_buffer_t *dbuf, u_short opc, u_short ext)
|
||||
static void opcode_fmove_ext(dis_buffer_t *dbuf, ut16 opc, ut16 ext)
|
||||
{
|
||||
int sz;
|
||||
|
||||
@ -1732,9 +1735,9 @@ static void opcode_fmove_ext(dis_buffer_t *dbuf, u_short opc, u_short ext)
|
||||
}
|
||||
|
||||
|
||||
static void opcode_mmu(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_mmu(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
u_short ext;
|
||||
ut16 ext;
|
||||
int type;
|
||||
|
||||
type = BITFIELD(opc,8,6);
|
||||
@ -1841,9 +1844,9 @@ static void opcode_mmu(dis_buffer_t *dbuf, u_short opc)
|
||||
}
|
||||
|
||||
|
||||
static void opcode_pflush(dis_buffer_t *dbuf, u_short opc, u_short ext)
|
||||
static void opcode_pflush(dis_buffer_t *dbuf, ut16 opc, ut16 ext)
|
||||
{
|
||||
u_short mode, mask, fc;
|
||||
ut16 mode, mask, fc;
|
||||
|
||||
mode = BITFIELD(ext,12,10);
|
||||
mask = BITFIELD(ext,8,5);
|
||||
@ -1903,7 +1906,7 @@ static void opcode_pflush(dis_buffer_t *dbuf, u_short opc, u_short ext)
|
||||
}
|
||||
|
||||
|
||||
static void opcode_pmove(dis_buffer_t *dbuf, u_short opc, u_short ext)
|
||||
static void opcode_pmove(dis_buffer_t *dbuf, ut16 opc, ut16 ext)
|
||||
{
|
||||
const char *reg;
|
||||
int rtom, sz, preg;
|
||||
@ -2015,7 +2018,7 @@ static void opcode_pmove(dis_buffer_t *dbuf, u_short opc, u_short ext)
|
||||
}
|
||||
|
||||
|
||||
static void print_fcode(dis_buffer_t *dbuf, u_short fc)
|
||||
static void print_fcode(dis_buffer_t *dbuf, ut16 fc)
|
||||
{
|
||||
if (ISBITSET(fc, 4)) {
|
||||
addchar('#'); /* ??? */
|
||||
@ -2030,7 +2033,7 @@ static void print_fcode(dis_buffer_t *dbuf, u_short fc)
|
||||
}
|
||||
|
||||
|
||||
static void opcode_mmu040(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_mmu040(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
if (ISBITSET(opc, 8)) {
|
||||
if (ISBITSET(opc, 6)) {
|
||||
@ -2106,9 +2109,9 @@ static void opcode_mmu040(dis_buffer_t *dbuf, u_short opc)
|
||||
* disassemble long format (64b) divs/muls divu/mulu opcode.
|
||||
* Note: opcode's dbuf->used already accounted for.
|
||||
*/
|
||||
static void opcode_divmul(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_divmul(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
u_short ext;
|
||||
ut16 ext;
|
||||
int iq, hr;
|
||||
|
||||
ext = read16(dbuf->val + 1);
|
||||
@ -2148,7 +2151,7 @@ static void opcode_divmul(dis_buffer_t *dbuf, u_short opc)
|
||||
}
|
||||
|
||||
|
||||
static void print_reglist(dis_buffer_t *dbuf, int mod, u_short rl)
|
||||
static void print_reglist(dis_buffer_t *dbuf, int mod, ut16 rl)
|
||||
{
|
||||
const char *const regs[16] = {
|
||||
"d0","d1","d2","d3","d4","d5","d6","d7",
|
||||
@ -2191,7 +2194,7 @@ static void print_reglist(dis_buffer_t *dbuf, int mod, u_short rl)
|
||||
}
|
||||
|
||||
|
||||
static void print_freglist(dis_buffer_t *dbuf, int mod, u_short rl, int cntl)
|
||||
static void print_freglist(dis_buffer_t *dbuf, int mod, ut16 rl, int cntl)
|
||||
{
|
||||
const char *const * regs;
|
||||
int bit, list, upper;
|
||||
@ -2240,9 +2243,9 @@ static void print_freglist(dis_buffer_t *dbuf, int mod, u_short rl, int cntl)
|
||||
/*
|
||||
* disassemble movem opcode.
|
||||
*/
|
||||
static void opcode_movem(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_movem(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
u_short rl;
|
||||
ut16 rl;
|
||||
|
||||
rl = read16(dbuf->val + 1);
|
||||
dbuf->used++;
|
||||
@ -2266,10 +2269,10 @@ static void opcode_movem(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* disassemble movec opcode.
|
||||
*/
|
||||
static void opcode_movec(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_movec(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
char *tmp;
|
||||
u_short ext;
|
||||
ut16 ext;
|
||||
|
||||
ext = read16(dbuf->val + 1);
|
||||
dbuf->used++;
|
||||
@ -2367,7 +2370,7 @@ static void opcode_movec(dis_buffer_t *dbuf, u_short opc)
|
||||
/*
|
||||
* disassemble move16 opcode.
|
||||
*/
|
||||
static void opcode_move16(dis_buffer_t *dbuf, u_short opc)
|
||||
static void opcode_move16(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
addstr(dbuf, "move16\t");
|
||||
|
||||
@ -2428,9 +2431,9 @@ static void iaddstr(dis_buffer_t *dbuf, const char *s)
|
||||
|
||||
static void get_modregstr_moto(dis_buffer_t *dbuf, int bit, int mod, int sz, int dd)
|
||||
{
|
||||
u_char scale, idx;
|
||||
ut8 scale, idx;
|
||||
const short *nval;
|
||||
u_short ext;
|
||||
ut16 ext;
|
||||
int disp, odisp, bd, od, reg;
|
||||
|
||||
odisp = 0;
|
||||
@ -2632,9 +2635,9 @@ static void get_modregstr_moto(dis_buffer_t *dbuf, int bit, int mod, int sz, int
|
||||
/* mit syntax makes for spaghetti parses */
|
||||
static void get_modregstr_mit(dis_buffer_t *dbuf,int bit, int mod, int sz, int dd)
|
||||
{
|
||||
u_char scale, idx;
|
||||
ut8 scale, idx;
|
||||
const short *nval;
|
||||
u_short ext;
|
||||
ut16 ext;
|
||||
int disp, odisp, bd, od, reg;
|
||||
|
||||
disp = odisp = 0;
|
||||
@ -2930,7 +2933,7 @@ static void get_immed(dis_buffer_t *dbuf, int sz)
|
||||
}
|
||||
|
||||
|
||||
static void get_fpustdGEN(dis_buffer_t *dbuf, u_short ext, const char *name)
|
||||
static void get_fpustdGEN(dis_buffer_t *dbuf, ut16 ext, const char *name)
|
||||
{
|
||||
int sz;
|
||||
|
||||
@ -3017,9 +3020,9 @@ static void get_fpustdGEN(dis_buffer_t *dbuf, u_short ext, const char *name)
|
||||
*/
|
||||
static void print_disp(dis_buffer_t *dbuf, int disp, int sz, int rel, int dd)
|
||||
{
|
||||
char *symname;
|
||||
u_long nv = 0;
|
||||
u_long diff;
|
||||
char *symname = NULL;
|
||||
ut32 nv = 0;
|
||||
size_t diff = INT_MAX;
|
||||
|
||||
if (dbuf == NULL)
|
||||
return;
|
||||
@ -3028,20 +3031,16 @@ static void print_disp(dis_buffer_t *dbuf, int disp, int sz, int rel, int dd)
|
||||
disp = (int)((short)disp);
|
||||
if (rel == -1) {
|
||||
/*phx - use sval to print real destination address */
|
||||
nv = disp + (u_long)dbuf->sval + 2*(dd+1);
|
||||
nv = disp + (size_t)dbuf->sval + 2*(dd+1);
|
||||
printu(dbuf, nv, SIZE_LONG);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (dbuf->dp->get_areg)
|
||||
nv = disp + dbuf->dp->get_areg(rel);
|
||||
prints(dbuf, disp, sz);
|
||||
}
|
||||
|
||||
diff = INT_MAX;
|
||||
symname = NULL;
|
||||
|
||||
if (dbuf && dbuf->dp && dbuf->dp->find_symbol) {
|
||||
if ((symname = dbuf->dp->find_symbol(nv,&diff))!= NULL) {
|
||||
if ((symname = dbuf->dp->find_symbol (nv, &diff))!= NULL) {
|
||||
iaddstr(dbuf, "disp:");
|
||||
iaddstr(dbuf, symname);
|
||||
iaddchar('+');
|
||||
@ -3052,17 +3051,13 @@ static void print_disp(dis_buffer_t *dbuf, int disp, int sz, int rel, int dd)
|
||||
}
|
||||
}
|
||||
|
||||
static void print_addr(dis_buffer_t *dbuf, u_long addr)
|
||||
static void print_addr(dis_buffer_t *dbuf, ut32 addr)
|
||||
{
|
||||
u_long diff = INT_MAX;
|
||||
size_t diff = INT_MAX;
|
||||
char *symname = NULL;
|
||||
|
||||
#if 0
|
||||
diff = INT_MAX;
|
||||
symname = NULL;
|
||||
#endif
|
||||
if (dbuf->dp->find_symbol) {
|
||||
if (symname == dbuf->dp->find_symbol(addr,&diff)) {
|
||||
if (symname == dbuf->dp->find_symbol(addr, &diff)) {
|
||||
if (diff == 0)
|
||||
addstr(dbuf,symname);
|
||||
else {
|
||||
@ -3118,37 +3113,37 @@ static void iprints(dis_buffer_t *dbuf, int val, int sz)
|
||||
#endif
|
||||
|
||||
|
||||
static void printu(dis_buffer_t *dbuf, u_int val, int sz)
|
||||
static void printu(dis_buffer_t *dbuf, ut32i val, int sz)
|
||||
{
|
||||
if (val == 0) {
|
||||
dbuf->casm[0] = '0';
|
||||
dbuf->casm[1] = 0;
|
||||
} else if (sz == SIZE_BYTE)
|
||||
printu_wb(dbuf, (u_char)val, sz, db_radix);
|
||||
printu_wb(dbuf, (ut8)val, sz, db_radix);
|
||||
else if (sz == SIZE_WORD)
|
||||
printu_wb(dbuf, (u_short)val, sz, db_radix);
|
||||
printu_wb(dbuf, (ut16)val, sz, db_radix);
|
||||
else
|
||||
printu_wb(dbuf, (u_long)val, sz, db_radix);
|
||||
printu_wb(dbuf, (ut32)val, sz, db_radix);
|
||||
dbuf->casm = &dbuf->casm[strlen(dbuf->casm)];
|
||||
}
|
||||
|
||||
|
||||
static void iprintu(dis_buffer_t *dbuf, u_int val, int sz)
|
||||
static void iprintu(dis_buffer_t *dbuf, ut32i val, int sz)
|
||||
{
|
||||
if (val == 0) {
|
||||
dbuf->cinfo[0] = '0';
|
||||
dbuf->cinfo[1] = 0;
|
||||
} else if (sz == SIZE_BYTE)
|
||||
iprintu_wb(dbuf, (u_char)val, sz, db_radix);
|
||||
iprintu_wb(dbuf, (ut8)val, sz, db_radix);
|
||||
else if (sz == SIZE_WORD)
|
||||
iprintu_wb(dbuf, (u_short)val, sz, db_radix);
|
||||
iprintu_wb(dbuf, (ut16)val, sz, db_radix);
|
||||
else
|
||||
iprintu_wb(dbuf, (u_long)val, sz, db_radix);
|
||||
iprintu_wb(dbuf, (ut32)val, sz, db_radix);
|
||||
dbuf->cinfo = &dbuf->cinfo[strlen(dbuf->cinfo)];
|
||||
}
|
||||
|
||||
|
||||
static void printu_wb(dis_buffer_t *dbuf, u_int val, int sz, int base)
|
||||
static void printu_wb(dis_buffer_t *dbuf, ut32i val, int sz, int base)
|
||||
{
|
||||
static char buf[sizeof(long) * NBBY / 3 + 2];
|
||||
char *p, ch;
|
||||
@ -3183,7 +3178,7 @@ static void prints_wb(dis_buffer_t *dbuf, int val, int sz, int base)
|
||||
}
|
||||
|
||||
|
||||
static void iprintu_wb(dis_buffer_t *dbuf, u_int val, int sz, int base)
|
||||
static void iprintu_wb(dis_buffer_t *dbuf, ut32i val, int sz, int base)
|
||||
{
|
||||
static char buf[sizeof(long) * NBBY / 3 + 2];
|
||||
char *p, ch;
|
||||
@ -3231,14 +3226,14 @@ static void prints_bf(dis_buffer_t *dbuf, int val, int sb, int eb)
|
||||
}
|
||||
|
||||
|
||||
static void printu_bf(dis_buffer_t *dbuf, u_int val, int sb, int eb)
|
||||
static void printu_bf(dis_buffer_t *dbuf, ut32i val, int sb, int eb)
|
||||
{
|
||||
printu(dbuf,BITFIELD(val,sb,eb),SIZE_LONG);
|
||||
}
|
||||
|
||||
|
||||
/* prints -(Ax),-(Ay) (phx)*/
|
||||
static void print_AxAyPredec(dis_buffer_t *dbuf, u_short opc)
|
||||
static void print_AxAyPredec(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
if (dbuf->mit) {
|
||||
PRINT_AREG(dbuf,BITFIELD(opc,2,0));
|
||||
@ -3257,7 +3252,7 @@ static void print_AxAyPredec(dis_buffer_t *dbuf, u_short opc)
|
||||
|
||||
|
||||
/* prints Dx,Dy (phx)*/
|
||||
static void print_DxDy(dis_buffer_t *dbuf, u_short opc)
|
||||
static void print_DxDy(dis_buffer_t *dbuf, ut16 opc)
|
||||
{
|
||||
PRINT_DREG(dbuf,BITFIELD(opc,2,0));
|
||||
addchar(',');
|
||||
@ -3266,7 +3261,7 @@ static void print_DxDy(dis_buffer_t *dbuf, u_short opc)
|
||||
|
||||
|
||||
/* prints (Rn) or (Rn)+ (phx)*/
|
||||
static void print_RnPlus(dis_buffer_t *dbuf, u_short opc, int An, int sb, int inc)
|
||||
static void print_RnPlus(dis_buffer_t *dbuf, ut16 opc, int An, int sb, int inc)
|
||||
{
|
||||
if (dbuf->mit) {
|
||||
if (An)
|
||||
|
@ -483,13 +483,11 @@ typedef struct dis_buffer dis_buffer_t;
|
||||
#define DB_STGY_PROC 0 /*@@@*/
|
||||
#define DB_STGY_ANY 0 /*@@@*/
|
||||
|
||||
#include <r_types.h>
|
||||
/* common Unix typedefs used in m68k_disasm.c */
|
||||
#define u_char unsigned char
|
||||
#define u_short unsigned short
|
||||
#define u_int unsigned int
|
||||
#define u_long unsigned long
|
||||
typedef unsigned long vm68k_offset_t;
|
||||
typedef unsigned long db_expr_t; /*@@@*/
|
||||
#define ut32i ut32
|
||||
typedef ut32 vm68k_offset_t;
|
||||
typedef ut32 db_expr_t; /*@@@*/
|
||||
typedef const char *db_sym_t; /*@@@*/
|
||||
|
||||
|
||||
|
@ -48,7 +48,9 @@
|
||||
#define EATAB {while (isascii((ut8) *l) && isspace((ut8) *l)) ++l;}
|
||||
#define LOWCASE(l) (isupper((ut8) (l)) ? tolower((ut8) (l)) : (l))
|
||||
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0
|
||||
#endif
|
||||
|
||||
struct r_magic_entry {
|
||||
struct r_magic *mp;
|
||||
|
@ -741,7 +741,8 @@ int r_print_format_struct_size(const char *f, RPrint *p, int mode) {
|
||||
|
||||
static int r_print_format_struct(RPrint* p, ut64 seek, const ut8* b, int len,
|
||||
char *name, int slide, int mode, const char *setval, char *field) {
|
||||
const char *fmt, namefmt[8];
|
||||
const char *fmt;
|
||||
char namefmt[8];
|
||||
if ((slide%STRUCTPTR) > NESTDEPTH || (slide%STRUCTFLAG)/STRUCTPTR > NESTDEPTH) {
|
||||
eprintf ("Too much nested struct, recursion too deep...\n");
|
||||
return 0;
|
||||
|
@ -42,7 +42,7 @@
|
||||
#endif
|
||||
|
||||
#define ALIGN_UP(addr, align) \
|
||||
((addr + (int) align - 1) & ~((int) align - 1))
|
||||
((addr + (size_t) align - 1) & ~((size_t) align - 1))
|
||||
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
|
||||
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user