These functions only read from memory, so mark the pointer as const.
/* Read the LENGTH bytes at BUF as a little-endian value. */
static bfd_vma
-get_le (unsigned char *buf, unsigned int length)
+get_le (const unsigned char *buf, unsigned int length)
{
bfd_vma acc = 0;
}
int
-Store_Iwmmxt_Register (unsigned int regnum, unsigned char * memory)
+Store_Iwmmxt_Register (unsigned int regnum, const unsigned char * memory)
{
if (regnum >= 16)
{
extern int ARMul_HandleIwmmxt (ARMul_State *, ARMword);
extern int Fetch_Iwmmxt_Register (unsigned int, unsigned char *);
-extern int Store_Iwmmxt_Register (unsigned int, unsigned char *);
+extern int Store_Iwmmxt_Register (unsigned int, const unsigned char *);
}
static int
-frommem (struct ARMul_State *state, unsigned char *memory)
+frommem (struct ARMul_State *state, const unsigned char *memory)
{
if (state->bigendSig == HIGH)
return (memory[0] << 24) | (memory[1] << 16)
}
static bu32
-bfin_extract_unsigned_integer (unsigned char *addr, int len)
+bfin_extract_unsigned_integer (const unsigned char *addr, int len)
{
bu32 retval;
unsigned char * p;
}
static uint32_t
-cr16_extract_unsigned_integer (unsigned char *addr, int len)
+cr16_extract_unsigned_integer (const unsigned char *addr, int len)
{
uint32_t retval;
unsigned char * p;
#undef ENDIAN_INLINE
#else
-extern uint32_t get_longword (uint8_t *);
-extern uint16_t get_word (uint8_t *);
-extern int64_t get_longlong (uint8_t *);
+extern uint32_t get_longword (const uint8_t *);
+extern uint16_t get_word (const uint8_t *);
+extern int64_t get_longlong (const uint8_t *);
extern void write_word (uint8_t *addr, uint16_t data);
extern void write_longword (uint8_t *addr, uint32_t data);
extern void write_longlong (uint8_t *addr, int64_t data);
#endif
ENDIAN_INLINE uint16_t
-get_word (uint8_t *x)
+get_word (const uint8_t *x)
{
return ((uint16_t)x[0]<<8) + x[1];
}
ENDIAN_INLINE uint32_t
-get_longword (uint8_t *x)
+get_longword (const uint8_t *x)
{
return ((uint32_t)x[0]<<24) + ((uint32_t)x[1]<<16) + ((uint32_t)x[2]<<8) + ((uint32_t)x[3]);
}
ENDIAN_INLINE int64_t
-get_longlong (uint8_t *x)
+get_longlong (const uint8_t *x)
{
uint32_t top = get_longword (x);
uint32_t bottom = get_longword (x+4);
#define RAM_BIAS 0x800000 /* Bias added to RAM addresses. */
static unsigned long
-ft32_extract_unsigned_integer (unsigned char *addr, int len)
+ft32_extract_unsigned_integer (const unsigned char *addr, int len)
{
unsigned long retval;
unsigned char *p;
/* Read the LENGTH bytes at BUF as an little-endian value. */
static DI
-get_le (unsigned char *buf, int length)
+get_le (const unsigned char *buf, int length)
{
DI acc = 0;
while (--length >= 0)
static unsigned long
-mcore_extract_unsigned_integer (unsigned char *addr, int len)
+mcore_extract_unsigned_integer (const unsigned char *addr, int len)
{
unsigned long retval;
unsigned char * p;
#define target_big_endian (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
static unsigned long
-microblaze_extract_unsigned_integer (unsigned char *addr, int len)
+microblaze_extract_unsigned_integer (const unsigned char *addr, int len)
{
unsigned long retval;
unsigned char *p;
+ (sim_core_read_aligned_1 (scpu, cia, read_map, addr+1))) << 16) >> 16)
static unsigned long
-moxie_extract_unsigned_integer (unsigned char *addr, int len)
+moxie_extract_unsigned_integer (const unsigned char *addr, int len)
{
unsigned long retval;
unsigned char * p;
/* Extract (from PRU endianess) and return an integer in HOST's endianness. */
static uint32_t
-pru_extract_unsigned_integer (uint8_t *addr, size_t len)
+pru_extract_unsigned_integer (const uint8_t *addr, size_t len)
{
uint32_t retval;
- uint8_t *p;
- uint8_t *startaddr = addr;
- uint8_t *endaddr = startaddr + len;
+ const uint8_t *p;
+ const uint8_t *startaddr = addr;
+ const uint8_t *endaddr = startaddr + len;
/* Start at the most significant end of the integer, and work towards
the least significant. */
/* Read the LENGTH bytes at BUF as an little-endian value. */
static SI
-get_le (unsigned char *buf, int length)
+get_le (const unsigned char *buf, int length)
{
SI acc = 0;
/* Read the LENGTH bytes at BUF as an little-endian value. */
static DI
-get_le (unsigned char *buf, int length)
+get_le (const unsigned char *buf, int length)
{
DI acc = 0;
while (--length >= 0)
/* Read the LENGTH bytes at BUF as a big-endian value. */
static DI
-get_be (unsigned char *buf, int length)
+get_be (const unsigned char *buf, int length)
{
DI acc = 0;
while (length-- > 0)