00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "sysdep.h"
00024 #include "dis-asm.h"
00025 #include <errno.h>
00026 #include "opintl.h"
00027
00028
00029
00030 int
00031 buffer_read_memory (memaddr, myaddr, length, info)
00032 bfd_vma memaddr;
00033 bfd_byte *myaddr;
00034 unsigned int length;
00035 struct disassemble_info *info;
00036 {
00037 unsigned int opb = info->octets_per_byte;
00038 unsigned int end_addr_offset = length / opb;
00039 unsigned int max_addr_offset = info->buffer_length / opb;
00040 unsigned int octets = (memaddr - info->buffer_vma) * opb;
00041
00042 if (memaddr < info->buffer_vma
00043 || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
00044
00045 return EIO;
00046 memcpy (myaddr, info->buffer + octets, length);
00047
00048 return 0;
00049 }
00050
00051
00052
00053 void
00054 perror_memory (status, memaddr, info)
00055 int status;
00056 bfd_vma memaddr;
00057 struct disassemble_info *info;
00058 {
00059 if (status != EIO)
00060
00061 info->fprintf_func (info->stream, _("Unknown error %d\n"), status);
00062 else
00063 {
00064 char buf[30];
00065
00066
00067
00068 sprintf_vma (buf, memaddr);
00069 info->fprintf_func (info->stream,
00070 _("Address 0x%s is out of bounds.\n"), buf);
00071 }
00072 }
00073
00074
00075
00076
00077
00078
00079
00080
00081 void
00082 generic_print_address (addr, info)
00083 bfd_vma addr;
00084 struct disassemble_info *info;
00085 {
00086 char buf[30];
00087
00088 sprintf_vma (buf, addr);
00089 (*info->fprintf_func) (info->stream, "0x%s", buf);
00090 }
00091
00092 #if 0
00093
00094
00095
00096
00097 void generic_strcat_address PARAMS ((bfd_vma, char *, int));
00098
00099 void
00100 generic_strcat_address (addr, buf, len)
00101 bfd_vma addr;
00102 char *buf;
00103 int len;
00104 {
00105 if (buf != (char *)NULL && len > 0)
00106 {
00107 char tmpBuf[30];
00108
00109 sprintf_vma (tmpBuf, addr);
00110 if ((strlen (buf) + strlen (tmpBuf)) <= (unsigned int) len)
00111 strcat (buf, tmpBuf);
00112 else
00113 strncat (buf, tmpBuf, (len - strlen(buf)));
00114 }
00115 return;
00116 }
00117 #endif
00118
00119
00120
00121 int
00122 generic_symbol_at_address (addr, info)
00123 bfd_vma addr ATTRIBUTE_UNUSED;
00124 struct disassemble_info *info ATTRIBUTE_UNUSED;
00125 {
00126 return 1;
00127 }
00128
00129
00130
00131 bfd_boolean
00132 generic_symbol_is_valid (asymbol * sym ATTRIBUTE_UNUSED,
00133 struct disassemble_info *info ATTRIBUTE_UNUSED)
00134 {
00135 return TRUE;
00136 }