target/register: use an array of uint8_t for register's value
The use of 'void *' makes the pointer arithmetic incompatible with standard C, even if this is allowed by GCC extensions. The use of 'void *' can also hide incorrect pointer assignments. Switch to 'uint8_t *' and add GCC warning flag to track any use of pointer arithmetic extension. Change-Id: Ic4d15a232834cd6b374330f70e2473a359b1607f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5937 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
This commit is contained in:
@@ -4128,7 +4128,7 @@ int riscv_init_registers(struct target *target)
|
||||
reg_name += strlen(reg_name) + 1;
|
||||
assert(reg_name < info->reg_names + target->reg_cache->num_regs *
|
||||
max_reg_name_len);
|
||||
r->value = &info->reg_cache_values[number];
|
||||
r->value = info->reg_cache_values[number];
|
||||
}
|
||||
|
||||
return ERROR_OK;
|
||||
|
||||
@@ -68,8 +68,8 @@ typedef struct {
|
||||
|
||||
/* OpenOCD's register cache points into here. This is not per-hart because
|
||||
* we just invalidate the entire cache when we change which hart is
|
||||
* selected. */
|
||||
uint64_t reg_cache_values[RISCV_MAX_REGISTERS];
|
||||
* selected. Use an array of 8 uint8_t per register. */
|
||||
uint8_t reg_cache_values[RISCV_MAX_REGISTERS][8];
|
||||
|
||||
/* Single buffer that contains all register names, instead of calling
|
||||
* malloc for each register. Needs to be freed when reg_list is freed. */
|
||||
|
||||
Reference in New Issue
Block a user