Search
lxdream.org :: lxdream/src/x86dasm/i386-dis.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/x86dasm/i386-dis.c
changeset 1094:d2324eb67223
prev968:6fb1481859a4
next1263:b3de98d19faf
author nkeynes
date Fri Feb 24 21:11:58 2012 +1000 (12 years ago)
permissions -rw-r--r--
last change Add preprocessing support to genglsl
file annotate diff log raw
1.1 --- a/src/x86dasm/i386-dis.c Thu Jan 15 11:23:20 2009 +0000
1.2 +++ b/src/x86dasm/i386-dis.c Fri Feb 24 21:11:58 2012 +1000
1.3 @@ -57,7 +57,6 @@
1.4 static void oappend (const char *);
1.5 static void append_seg (void);
1.6 static void OP_indirE (int, int);
1.7 -static void print_operand_value (char *, int, bfd_vma);
1.8 static void OP_E (int, int);
1.9 static void OP_G (int, int);
1.10 static bfd_vma get64 (void);
1.11 @@ -3058,66 +3057,6 @@
1.12 }
1.13
1.14 static void
1.15 -print_operand_value (char *buf, int hex, bfd_vma disp)
1.16 -{
1.17 - if (mode_64bit)
1.18 - {
1.19 - if (hex)
1.20 - {
1.21 - char tmp[30];
1.22 - int i;
1.23 - buf[0] = '0';
1.24 - buf[1] = 'x';
1.25 - sprintf_vma (tmp, disp);
1.26 - for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
1.27 - strcpy (buf + 2, tmp + i);
1.28 - }
1.29 - else
1.30 - {
1.31 - bfd_signed_vma v = disp;
1.32 - char tmp[30];
1.33 - int i;
1.34 - if (v < 0)
1.35 - {
1.36 - *(buf++) = '-';
1.37 - v = -disp;
1.38 - /* Check for possible overflow on 0x8000000000000000. */
1.39 - if (v < 0)
1.40 - {
1.41 - strcpy (buf, "9223372036854775808");
1.42 - return;
1.43 - }
1.44 - }
1.45 - if (!v)
1.46 - {
1.47 - strcpy (buf, "0");
1.48 - return;
1.49 - }
1.50 -
1.51 - i = 0;
1.52 - tmp[29] = 0;
1.53 - while (v)
1.54 - {
1.55 - tmp[28 - i] = (v % 10) + '0';
1.56 - v /= 10;
1.57 - i++;
1.58 - }
1.59 - strcpy (buf, tmp + 29 - i);
1.60 - }
1.61 - }
1.62 - else
1.63 - {
1.64 - x86_print_symbolic_operand( buf, hex, disp );
1.65 - /*
1.66 - if (hex)
1.67 - sprintf (buf, "0x%x", (unsigned int) disp);
1.68 - else
1.69 - sprintf (buf, "%d", (int) disp);
1.70 - */
1.71 - }
1.72 -}
1.73 -
1.74 -static void
1.75 OP_E (int bytemode, int sizeflag)
1.76 {
1.77 bfd_vma disp;
1.78 @@ -3236,7 +3175,7 @@
1.79 if (!intel_syntax)
1.80 if (mod != 0 || (base & 7) == 5)
1.81 {
1.82 - print_operand_value (scratchbuf, !riprel, disp);
1.83 + x86_print_symbolic_operand (scratchbuf, !riprel, disp);
1.84 oappend (scratchbuf);
1.85 if (riprel)
1.86 {
1.87 @@ -3342,7 +3281,7 @@
1.88 *obufp = '\0';
1.89 }
1.90
1.91 - print_operand_value (scratchbuf, 0, disp);
1.92 + x86_print_symbolic_operand (scratchbuf, 0, disp);
1.93 oappend (scratchbuf);
1.94 }
1.95 }
1.96 @@ -3362,7 +3301,7 @@
1.97 oappend (names_seg[ds_reg - es_reg]);
1.98 oappend (":");
1.99 }
1.100 - print_operand_value (scratchbuf, 1, disp);
1.101 + x86_print_symbolic_operand (scratchbuf, 1, disp);
1.102 oappend (scratchbuf);
1.103 }
1.104 }
1.105 @@ -3395,7 +3334,7 @@
1.106 if (!intel_syntax)
1.107 if (mod != 0 || (rm & 7) == 6)
1.108 {
1.109 - print_operand_value (scratchbuf, 0, disp);
1.110 + x86_print_symbolic_operand (scratchbuf, 0, disp);
1.111 oappend (scratchbuf);
1.112 }
1.113
1.114 @@ -3693,7 +3632,7 @@
1.115
1.116 op &= mask;
1.117 scratchbuf[0] = '$';
1.118 - print_operand_value (scratchbuf + 1, 1, op);
1.119 + x86_print_symbolic_operand (scratchbuf + 1, 1, op);
1.120 oappend (scratchbuf + intel_syntax);
1.121 scratchbuf[0] = '\0';
1.122 }
1.123 @@ -3744,7 +3683,7 @@
1.124
1.125 op &= mask;
1.126 scratchbuf[0] = '$';
1.127 - print_operand_value (scratchbuf + 1, 1, op);
1.128 + x86_print_symbolic_operand (scratchbuf + 1, 1, op);
1.129 oappend (scratchbuf + intel_syntax);
1.130 scratchbuf[0] = '\0';
1.131 }
1.132 @@ -3794,7 +3733,7 @@
1.133 }
1.134
1.135 scratchbuf[0] = '$';
1.136 - print_operand_value (scratchbuf + 1, 1, op);
1.137 + x86_print_symbolic_operand (scratchbuf + 1, 1, op);
1.138 oappend (scratchbuf + intel_syntax);
1.139 }
1.140
1.141 @@ -3830,7 +3769,7 @@
1.142 }
1.143 disp = (start_pc + codep - start_codep + disp) & mask;
1.144 set_op (disp, 0);
1.145 - print_operand_value (scratchbuf, 1, disp);
1.146 + x86_print_symbolic_operand (scratchbuf, 1, disp);
1.147 oappend (scratchbuf);
1.148 }
1.149
1.150 @@ -3884,7 +3823,7 @@
1.151 oappend (":");
1.152 }
1.153 }
1.154 - print_operand_value (scratchbuf, 1, off);
1.155 + x86_print_symbolic_operand (scratchbuf, 1, off);
1.156 oappend (scratchbuf);
1.157 }
1.158
1.159 @@ -3912,7 +3851,7 @@
1.160 oappend (":");
1.161 }
1.162 }
1.163 - print_operand_value (scratchbuf, 1, off);
1.164 + x86_print_symbolic_operand (scratchbuf, 1, off);
1.165 oappend (scratchbuf);
1.166 }
1.167
.