LOG_DEBUG("%s", __func__);
-#ifdef ARMV7_GDB_HACKS
- /* If the LR register is being modified, make sure it will put us
- * in "thumb" mode, or an INVSTATE exception will occur. This is a
- * hack to deal with the fact that gdb will sometimes "forge"
- * return addresses, and doesn't set the LSB correctly (i.e., when
- * printing expressions containing function calls, it sets LR = 0.)
- * Valid exception return codes have bit 0 set too.
- */
- if (num == ARMV7M_R14)
- value |= 0x01;
-#endif
-
/* NOTE: we "know" here that the register identifiers used
* in the v7m header match the Cortex-M3 Debug Core Register
* Selector values for R0..R15, xPSR, MSP, and PSP.
static int hl_dcc_read(struct hl_interface_s *hl_if, uint8_t *value, uint8_t *ctrl)
{
uint16_t dcrdr;
- int retval = hl_if->layout->api->read_mem8(hl_if->fd,
- DCB_DCRDR, sizeof(dcrdr), (uint8_t *)&dcrdr);
+ int retval = hl_if->layout->api->read_mem(hl_if->fd,
+ DCB_DCRDR, 1, sizeof(dcrdr), (uint8_t *)&dcrdr);
if (retval == ERROR_OK) {
*ctrl = (uint8_t)dcrdr;
*value = (uint8_t)(dcrdr >> 8);
* to signify we have read data */
/* atomically clear just the byte containing the busy bit */
static const uint8_t zero;
- retval = hl_if->layout->api->write_mem8(
- hl_if->fd, DCB_DCRDR, 1, &zero);
+ retval = hl_if->layout->api->write_mem(hl_if->fd, DCB_DCRDR, 1, 1, &zero);
}
}
return retval;
/* make sure we clear the vector catch bit */
adapter->layout->api->write_debug_reg(adapter->fd, DCB_DEMCR, TRCENA);
- r = arm->core_cache->reg_list + ARMV7M_xPSR;
+ r = arm->cpsr;
xPSR = buf_get_u32(r->value, 0, 32);
/* Are we in an exception handler */
else
c = count;
- if (size != 4)
- res = adapter->layout->api->read_mem8(adapter->fd,
- address, c, buffer);
- else
- res = adapter->layout->api->read_mem32(adapter->fd,
- address, c, buffer);
-
+ res = adapter->layout->api->read_mem(adapter->fd, address, size, c, buffer);
if (res != ERROR_OK)
return res;
else
c = count;
- if (size != 4)
- res = adapter->layout->api->write_mem8(adapter->fd,
- address, c, buffer);
- else
- res = adapter->layout->api->write_mem32(adapter->fd,
- address, c, buffer);
-
+ res = adapter->layout->api->write_mem(adapter->fd, address, size, c, buffer);
if (res != ERROR_OK)
return res;