projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update Gnulib to the latest git version
[deliverable/binutils-gdb.git]
/
opcodes
/
tic30-dis.c
diff --git
a/opcodes/tic30-dis.c
b/opcodes/tic30-dis.c
index c6d0e3ed723866790708457f18ab3cb12d494558..29948f40196f029dccc62e2668a4718f01d06023 100644
(file)
--- a/
opcodes/tic30-dis.c
+++ b/
opcodes/tic30-dis.c
@@
-1,6
+1,5
@@
/* Disassembly routines for TMS320C30 architecture
/* Disassembly routines for TMS320C30 architecture
- Copyright 1998, 1999, 2000, 2002, 2005, 2007, 2009
- Free Software Foundation, Inc.
+ Copyright (C) 1998-2019 Free Software Foundation, Inc.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of the GNU opcodes library.
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
This file is part of the GNU opcodes library.
@@
-20,10
+19,10
@@
Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
+#include "sysdep.h"
#include <errno.h>
#include <math.h>
#include <errno.h>
#include <math.h>
-#include "sysdep.h"
-#include "dis-asm.h"
+#include "disassemble.h"
#include "opcode/tic30.h"
#define NORMAL_INSN 1
#include "opcode/tic30.h"
#define NORMAL_INSN 1
@@
-189,6
+188,8
@@
get_tic30_instruction (unsigned long insn_word, struct instruction *insn)
return 1;
}
return 1;
}
+#define OPERAND_BUFFER_LEN 15
+
static int
get_register_operand (unsigned char fragment, char *buffer)
{
static int
get_register_operand (unsigned char fragment, char *buffer)
{
@@
-200,7
+201,8
@@
get_register_operand (unsigned char fragment, char *buffer)
{
if ((fragment & 0x1F) == current_reg->opcode)
{
{
if ((fragment & 0x1F) == current_reg->opcode)
{
- strcpy (buffer, current_reg->name);
+ strncpy (buffer, current_reg->name, OPERAND_BUFFER_LEN);
+ buffer[OPERAND_BUFFER_LEN - 1] = 0;
return 1;
}
}
return 1;
}
}
@@
-251,16
+253,25
@@
get_indirect_operand (unsigned short fragment,
int bufcnt;
len = strlen (current_ind->syntax);
int bufcnt;
len = strlen (current_ind->syntax);
+
for (i = 0, bufcnt = 0; i < len; i++, bufcnt++)
{
buffer[bufcnt] = current_ind->syntax[i];
for (i = 0, bufcnt = 0; i < len; i++, bufcnt++)
{
buffer[bufcnt] = current_ind->syntax[i];
- if (buffer[bufcnt - 1] == 'a' && buffer[bufcnt] == 'r')
+
+ if (bufcnt > 0
+ && bufcnt < OPERAND_BUFFER_LEN - 1
+ && buffer[bufcnt - 1] == 'a'
+ && buffer[bufcnt] == 'r')
buffer[++bufcnt] = arnum + '0';
buffer[++bufcnt] = arnum + '0';
- if (buffer[bufcnt] == '('
+
+ if (bufcnt < OPERAND_BUFFER_LEN - 1
+ && buffer[bufcnt] == '('
&& current_ind->displacement == DISP_REQUIRED)
{
&& current_ind->displacement == DISP_REQUIRED)
{
- sprintf (&buffer[bufcnt + 1], "%u", disp);
- bufcnt += strlen (&buffer[bufcnt + 1]);
+ snprintf (buffer + (bufcnt + 1),
+ OPERAND_BUFFER_LEN - (bufcnt + 1),
+ "%u", disp);
+ bufcnt += strlen (buffer + (bufcnt + 1));
}
}
buffer[bufcnt + 1] = '\0';
}
}
buffer[bufcnt + 1] = '\0';
@@
-341,7
+352,7
@@
print_two_operand (disassemble_info *info,
struct instruction *insn)
{
char name[12];
struct instruction *insn)
{
char name[12];
- char operand[2][
13
] =
+ char operand[2][
OPERAND_BUFFER_LEN
] =
{
{0},
{0}
{
{0},
{0}
@@
-428,7
+439,7
@@
print_three_operand (disassemble_info *info,
unsigned long insn_word,
struct instruction *insn)
{
unsigned long insn_word,
struct instruction *insn)
{
- char operand[3][
13
] =
+ char operand[3][
OPERAND_BUFFER_LEN
] =
{
{0},
{0},
{
{0},
{0},
@@
-474,7
+485,7
@@
print_par_insn (disassemble_info *info,
{
size_t i, len;
char *name1, *name2;
{
size_t i, len;
char *name1, *name2;
- char operand[2][3][
13
] =
+ char operand[2][3][
OPERAND_BUFFER_LEN
] =
{
{
{0},
{
{
{0},
@@
-596,7
+607,7
@@
print_branch (disassemble_info *info,
unsigned long insn_word,
struct instruction *insn)
{
unsigned long insn_word,
struct instruction *insn)
{
- char operand[2][
13
] =
+ char operand[2][
OPERAND_BUFFER_LEN
] =
{
{0},
{0}
{
{0},
{0}
@@
-670,9
+681,9
@@
print_branch (disassemble_info *info,
if (address == 0)
info->fprintf_func (info->stream, " <%s>", sym->name);
else
if (address == 0)
info->fprintf_func (info->stream, " <%s>", sym->name);
else
- info->fprintf_func (info->stream, " <%s %c %
d
>", sym->name,
+ info->fprintf_func (info->stream, " <%s %c %
lu
>", sym->name,
((short) address < 0) ? '-' : '+',
((short) address < 0) ? '-' : '+',
- a
bs (address)
);
+ a
ddress
);
}
return 1;
}
}
return 1;
}
This page took
0.027072 seconds
and
4
git commands to generate.