You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1383 lines
36 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2008 digenius technology GmbH. *
  3. * Michael Bruck *
  4. * *
  5. * Copyright (C) 2008,2009 Oyvind Harboe oyvind.harboe@zylin.com *
  6. * *
  7. * Copyright (C) 2008 Georg Acher <acher@in.tum.de> *
  8. * *
  9. * Copyright (C) 2009 David Brownell *
  10. * *
  11. * This program is free software; you can redistribute it and/or modify *
  12. * it under the terms of the GNU General Public License as published by *
  13. * the Free Software Foundation; either version 2 of the License, or *
  14. * (at your option) any later version. *
  15. * *
  16. * This program is distributed in the hope that it will be useful, *
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  19. * GNU General Public License for more details. *
  20. * *
  21. * You should have received a copy of the GNU General Public License *
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>. *
  23. ***************************************************************************/
  24. #ifdef HAVE_CONFIG_H
  25. #include "config.h"
  26. #endif
  27. #include "etm.h"
  28. #include "breakpoints.h"
  29. #include "arm11_dbgtap.h"
  30. #include "arm_simulator.h"
  31. #include <helper/time_support.h>
  32. #include "target_type.h"
  33. #include "algorithm.h"
  34. #include "register.h"
  35. #include "arm_opcodes.h"
  36. #if 0
  37. #define _DEBUG_INSTRUCTION_EXECUTION_
  38. #endif
  39. static int arm11_step(struct target *target, int current,
  40. target_addr_t address, int handle_breakpoints);
  41. /** Check and if necessary take control of the system
  42. *
  43. * \param arm11 Target state variable.
  44. */
  45. static int arm11_check_init(struct arm11_common *arm11)
  46. {
  47. CHECK_RETVAL(arm11_read_DSCR(arm11));
  48. if (!(arm11->dscr & DSCR_HALT_DBG_MODE)) {
  49. LOG_DEBUG("DSCR %08x", (unsigned) arm11->dscr);
  50. LOG_DEBUG("Bringing target into debug mode");
  51. arm11->dscr |= DSCR_HALT_DBG_MODE;
  52. CHECK_RETVAL(arm11_write_DSCR(arm11, arm11->dscr));
  53. /* add further reset initialization here */
  54. arm11->simulate_reset_on_next_halt = true;
  55. if (arm11->dscr & DSCR_CORE_HALTED) {
  56. /** \todo TODO: this needs further scrutiny because
  57. * arm11_debug_entry() never gets called. (WHY NOT?)
  58. * As a result we don't read the actual register states from
  59. * the target.
  60. */
  61. arm11->arm.target->state = TARGET_HALTED;
  62. arm_dpm_report_dscr(arm11->arm.dpm, arm11->dscr);
  63. } else {
  64. arm11->arm.target->state = TARGET_RUNNING;
  65. arm11->arm.target->debug_reason = DBG_REASON_NOTHALTED;
  66. }
  67. CHECK_RETVAL(arm11_sc7_clear_vbw(arm11));
  68. }
  69. return ERROR_OK;
  70. }
  71. /**
  72. * Save processor state. This is called after a HALT instruction
  73. * succeeds, and on other occasions the processor enters debug mode
  74. * (breakpoint, watchpoint, etc). Caller has updated arm11->dscr.
  75. */
  76. static int arm11_debug_entry(struct arm11_common *arm11)
  77. {
  78. int retval;
  79. arm11->arm.target->state = TARGET_HALTED;
  80. arm_dpm_report_dscr(arm11->arm.dpm, arm11->dscr);
  81. /* REVISIT entire cache should already be invalid !!! */
  82. register_cache_invalidate(arm11->arm.core_cache);
  83. /* See e.g. ARM1136 TRM, "14.8.4 Entering Debug state" */
  84. /* maybe save wDTR (pending DCC write to debug SW, e.g. libdcc) */
  85. arm11->is_wdtr_saved = !!(arm11->dscr & DSCR_DTR_TX_FULL);
  86. if (arm11->is_wdtr_saved) {
  87. arm11_add_debug_SCAN_N(arm11, 0x05, ARM11_TAP_DEFAULT);
  88. arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT);
  89. struct scan_field chain5_fields[3];
  90. arm11_setup_field(arm11, 32, NULL,
  91. &arm11->saved_wdtr, chain5_fields + 0);
  92. arm11_setup_field(arm11, 1, NULL, NULL, chain5_fields + 1);
  93. arm11_setup_field(arm11, 1, NULL, NULL, chain5_fields + 2);
  94. arm11_add_dr_scan_vc(arm11->arm.target->tap, ARRAY_SIZE(
  95. chain5_fields), chain5_fields, TAP_DRPAUSE);
  96. }
  97. /* DSCR: set the Execute ARM instruction enable bit.
  98. *
  99. * ARM1176 spec says this is needed only for wDTR/rDTR's "ITR mode",
  100. * but not to issue ITRs(?). The ARMv7 arch spec says it's required
  101. * for executing instructions via ITR.
  102. */
  103. CHECK_RETVAL(arm11_write_DSCR(arm11, DSCR_ITR_EN | arm11->dscr));
  104. /* From the spec:
  105. Before executing any instruction in debug state you have to drain the write buffer.
  106. This ensures that no imprecise Data Aborts can return at a later point:*/
  107. /** \todo TODO: Test drain write buffer. */
  108. #if 0
  109. while (1) {
  110. /* MRC p14,0,R0,c5,c10,0 */
  111. /* arm11_run_instr_no_data1(arm11, / *0xee150e1a* /0xe320f000); */
  112. /* mcr 15, 0, r0, cr7, cr10, {4} */
  113. arm11_run_instr_no_data1(arm11, 0xee070f9a);
  114. uint32_t dscr = arm11_read_DSCR(arm11);
  115. LOG_DEBUG("DRAIN, DSCR %08x", dscr);
  116. if (dscr & ARM11_DSCR_STICKY_IMPRECISE_DATA_ABORT) {
  117. arm11_run_instr_no_data1(arm11, 0xe320f000);
  118. dscr = arm11_read_DSCR(arm11);
  119. LOG_DEBUG("DRAIN, DSCR %08x (DONE)", dscr);
  120. break;
  121. }
  122. }
  123. #endif
  124. /* Save registers.
  125. *
  126. * NOTE: ARM1136 TRM suggests saving just R0 here now, then
  127. * CPSR and PC after the rDTR stuff. We do it all at once.
  128. */
  129. retval = arm_dpm_read_current_registers(&arm11->dpm);
  130. if (retval != ERROR_OK)
  131. LOG_ERROR("DPM REG READ -- fail");
  132. retval = arm11_run_instr_data_prepare(arm11);
  133. if (retval != ERROR_OK)
  134. return retval;
  135. /* maybe save rDTR (pending DCC read from debug SW, e.g. libdcc) */
  136. arm11->is_rdtr_saved = !!(arm11->dscr & DSCR_DTR_RX_FULL);
  137. if (arm11->is_rdtr_saved) {
  138. /* MRC p14,0,R0,c0,c5,0 (move rDTR -> r0 (-> wDTR -> local var)) */
  139. retval = arm11_run_instr_data_from_core_via_r0(arm11,
  140. 0xEE100E15, &arm11->saved_rdtr);
  141. if (retval != ERROR_OK)
  142. return retval;
  143. }
  144. /* REVISIT Now that we've saved core state, there's may also
  145. * be MMU and cache state to care about ...
  146. */
  147. if (arm11->simulate_reset_on_next_halt) {
  148. arm11->simulate_reset_on_next_halt = false;
  149. LOG_DEBUG("Reset c1 Control Register");
  150. /* Write 0 (reset value) to Control register 0 to disable MMU/Cache etc. */
  151. /* MCR p15,0,R0,c1,c0,0 */
  152. retval = arm11_run_instr_data_to_core_via_r0(arm11, 0xee010f10, 0);
  153. if (retval != ERROR_OK)
  154. return retval;
  155. }
  156. if (arm11->arm.target->debug_reason == DBG_REASON_WATCHPOINT) {
  157. uint32_t wfar;
  158. /* MRC p15, 0, <Rd>, c6, c0, 1 ; Read WFAR */
  159. retval = arm11_run_instr_data_from_core_via_r0(arm11,
  160. ARMV4_5_MRC(15, 0, 0, 6, 0, 1),
  161. &wfar);
  162. if (retval != ERROR_OK)
  163. return retval;
  164. arm_dpm_report_wfar(arm11->arm.dpm, wfar);
  165. }
  166. retval = arm11_run_instr_data_finish(arm11);
  167. if (retval != ERROR_OK)
  168. return retval;
  169. return ERROR_OK;
  170. }
  171. /**
  172. * Restore processor state. This is called in preparation for
  173. * the RESTART function.
  174. */
  175. static int arm11_leave_debug_state(struct arm11_common *arm11, bool bpwp)
  176. {
  177. int retval;
  178. /* See e.g. ARM1136 TRM, "14.8.5 Leaving Debug state" */
  179. /* NOTE: the ARM1136 TRM suggests restoring all registers
  180. * except R0/PC/CPSR right now. Instead, we do them all
  181. * at once, just a bit later on.
  182. */
  183. /* REVISIT once we start caring about MMU and cache state,
  184. * address it here ...
  185. */
  186. /* spec says clear wDTR and rDTR; we assume they are clear as
  187. otherwise our programming would be sloppy */
  188. {
  189. CHECK_RETVAL(arm11_read_DSCR(arm11));
  190. if (arm11->dscr & (DSCR_DTR_RX_FULL | DSCR_DTR_TX_FULL)) {
  191. /*
  192. The wDTR/rDTR two registers that are used to send/receive data to/from
  193. the core in tandem with corresponding instruction codes that are
  194. written into the core. The RDTR FULL/WDTR FULL flag indicates that the
  195. registers hold data that was written by one side (CPU or JTAG) and not
  196. read out by the other side.
  197. */
  198. LOG_ERROR("wDTR/rDTR inconsistent (DSCR %08x)",
  199. (unsigned) arm11->dscr);
  200. return ERROR_FAIL;
  201. }
  202. }
  203. /* maybe restore original wDTR */
  204. if (arm11->is_wdtr_saved) {
  205. retval = arm11_run_instr_data_prepare(arm11);
  206. if (retval != ERROR_OK)
  207. return retval;
  208. /* MCR p14,0,R0,c0,c5,0 */
  209. retval = arm11_run_instr_data_to_core_via_r0(arm11,
  210. 0xee000e15, arm11->saved_wdtr);
  211. if (retval != ERROR_OK)
  212. return retval;
  213. retval = arm11_run_instr_data_finish(arm11);
  214. if (retval != ERROR_OK)
  215. return retval;
  216. }
  217. /* restore CPSR, PC, and R0 ... after flushing any modified
  218. * registers.
  219. */
  220. CHECK_RETVAL(arm_dpm_write_dirty_registers(&arm11->dpm, bpwp));
  221. CHECK_RETVAL(arm11_bpwp_flush(arm11));
  222. register_cache_invalidate(arm11->arm.core_cache);
  223. /* restore DSCR */
  224. CHECK_RETVAL(arm11_write_DSCR(arm11, arm11->dscr));
  225. /* maybe restore rDTR */
  226. if (arm11->is_rdtr_saved) {
  227. arm11_add_debug_SCAN_N(arm11, 0x05, ARM11_TAP_DEFAULT);
  228. arm11_add_IR(arm11, ARM11_EXTEST, ARM11_TAP_DEFAULT);
  229. struct scan_field chain5_fields[3];
  230. uint8_t Ready = 0; /* ignored */
  231. uint8_t Valid = 0; /* ignored */
  232. arm11_setup_field(arm11, 32, &arm11->saved_rdtr,
  233. NULL, chain5_fields + 0);
  234. arm11_setup_field(arm11, 1, &Ready, NULL, chain5_fields + 1);
  235. arm11_setup_field(arm11, 1, &Valid, NULL, chain5_fields + 2);
  236. arm11_add_dr_scan_vc(arm11->arm.target->tap, ARRAY_SIZE(
  237. chain5_fields), chain5_fields, TAP_DRPAUSE);
  238. }
  239. /* now processor is ready to RESTART */
  240. return ERROR_OK;
  241. }
  242. /* poll current target status */
  243. static int arm11_poll(struct target *target)
  244. {
  245. int retval;
  246. struct arm11_common *arm11 = target_to_arm11(target);
  247. CHECK_RETVAL(arm11_check_init(arm11));
  248. if (arm11->dscr & DSCR_CORE_HALTED) {
  249. if (target->state != TARGET_HALTED) {
  250. enum target_state old_state = target->state;
  251. LOG_DEBUG("enter TARGET_HALTED");
  252. retval = arm11_debug_entry(arm11);
  253. if (retval != ERROR_OK)
  254. return retval;
  255. target_call_event_callbacks(target,
  256. (old_state == TARGET_DEBUG_RUNNING)
  257. ? TARGET_EVENT_DEBUG_HALTED
  258. : TARGET_EVENT_HALTED);
  259. }
  260. } else {
  261. if (target->state != TARGET_RUNNING && target->state != TARGET_DEBUG_RUNNING) {
  262. LOG_DEBUG("enter TARGET_RUNNING");
  263. target->state = TARGET_RUNNING;
  264. target->debug_reason = DBG_REASON_NOTHALTED;
  265. }
  266. }
  267. return ERROR_OK;
  268. }
  269. /* architecture specific status reply */
  270. static int arm11_arch_state(struct target *target)
  271. {
  272. struct arm11_common *arm11 = target_to_arm11(target);
  273. int retval;
  274. retval = arm_arch_state(target);
  275. /* REVISIT also display ARM11-specific MMU and cache status ... */
  276. if (target->debug_reason == DBG_REASON_WATCHPOINT)
  277. LOG_USER("Watchpoint triggered at PC %#08x",
  278. (unsigned) arm11->dpm.wp_pc);
  279. return retval;
  280. }
  281. /* target execution control */
  282. static int arm11_halt(struct target *target)
  283. {
  284. struct arm11_common *arm11 = target_to_arm11(target);
  285. LOG_DEBUG("target->state: %s",
  286. target_state_name(target));
  287. if (target->state == TARGET_UNKNOWN)
  288. arm11->simulate_reset_on_next_halt = true;
  289. if (target->state == TARGET_HALTED) {
  290. LOG_DEBUG("target was already halted");
  291. return ERROR_OK;
  292. }
  293. arm11_add_IR(arm11, ARM11_HALT, TAP_IDLE);
  294. CHECK_RETVAL(jtag_execute_queue());
  295. int i = 0;
  296. while (1) {
  297. CHECK_RETVAL(arm11_read_DSCR(arm11));
  298. if (arm11->dscr & DSCR_CORE_HALTED)
  299. break;
  300. int64_t then = 0;
  301. if (i == 1000)
  302. then = timeval_ms();
  303. if (i >= 1000) {
  304. if ((timeval_ms()-then) > 1000) {
  305. LOG_WARNING("Timeout (1000ms) waiting for instructions to complete");
  306. return ERROR_FAIL;
  307. }
  308. }
  309. i++;
  310. }
  311. enum target_state old_state = target->state;
  312. CHECK_RETVAL(arm11_debug_entry(arm11));
  313. CHECK_RETVAL(
  314. target_call_event_callbacks(target,
  315. old_state ==
  316. TARGET_DEBUG_RUNNING ? TARGET_EVENT_DEBUG_HALTED : TARGET_EVENT_HALTED));
  317. return ERROR_OK;
  318. }
  319. static uint32_t arm11_nextpc(struct arm11_common *arm11, int current, uint32_t address)
  320. {
  321. void *value = arm11->arm.pc->value;
  322. /* use the current program counter */
  323. if (current)
  324. address = buf_get_u32(value, 0, 32);
  325. /* Make sure that the gdb thumb fixup does not
  326. * kill the return address
  327. */
  328. switch (arm11->arm.core_state) {
  329. case ARM_STATE_ARM:
  330. address &= 0xFFFFFFFC;
  331. break;
  332. case ARM_STATE_THUMB:
  333. /* When the return address is loaded into PC
  334. * bit 0 must be 1 to stay in Thumb state
  335. */
  336. address |= 0x1;
  337. break;
  338. /* catch-all for JAZELLE and THUMB_EE */
  339. default:
  340. break;
  341. }
  342. buf_set_u32(value, 0, 32, address);
  343. arm11->arm.pc->dirty = 1;
  344. arm11->arm.pc->valid = 1;
  345. return address;
  346. }
  347. static int arm11_resume(struct target *target, int current,
  348. target_addr_t address, int handle_breakpoints, int debug_execution)
  349. {
  350. /* LOG_DEBUG("current %d address %08x handle_breakpoints %d debug_execution %d", */
  351. /* current, address, handle_breakpoints, debug_execution); */
  352. struct arm11_common *arm11 = target_to_arm11(target);
  353. LOG_DEBUG("target->state: %s",
  354. target_state_name(target));
  355. if (target->state != TARGET_HALTED) {
  356. LOG_ERROR("Target not halted");
  357. return ERROR_TARGET_NOT_HALTED;
  358. }
  359. address = arm11_nextpc(arm11, current, address);
  360. LOG_DEBUG("RESUME PC %08" TARGET_PRIxADDR "%s", address, !current ? "!" : "");
  361. /* clear breakpoints/watchpoints and VCR*/
  362. CHECK_RETVAL(arm11_sc7_clear_vbw(arm11));
  363. if (!debug_execution)
  364. target_free_all_working_areas(target);
  365. /* Should we skip over breakpoints matching the PC? */
  366. if (handle_breakpoints) {
  367. struct breakpoint *bp;
  368. for (bp = target->breakpoints; bp; bp = bp->next) {
  369. if (bp->address == address) {
  370. LOG_DEBUG("must step over %08" TARGET_PRIxADDR "", bp->address);
  371. arm11_step(target, 1, 0, 0);
  372. break;
  373. }
  374. }
  375. }
  376. /* activate all breakpoints */
  377. if (true) {
  378. struct breakpoint *bp;
  379. unsigned brp_num = 0;
  380. for (bp = target->breakpoints; bp; bp = bp->next) {
  381. struct arm11_sc7_action brp[2];
  382. brp[0].write = 1;
  383. brp[0].address = ARM11_SC7_BVR0 + brp_num;
  384. brp[0].value = bp->address;
  385. brp[1].write = 1;
  386. brp[1].address = ARM11_SC7_BCR0 + brp_num;
  387. brp[1].value = 0x1 |
  388. (3 <<
  389. 1) | (0x0F << 5) | (0 << 14) | (0 << 16) | (0 << 20) | (0 << 21);
  390. CHECK_RETVAL(arm11_sc7_run(arm11, brp, ARRAY_SIZE(brp)));
  391. LOG_DEBUG("Add BP %d at %08" TARGET_PRIxADDR, brp_num,
  392. bp->address);
  393. brp_num++;
  394. }
  395. if (arm11->vcr)
  396. CHECK_RETVAL(arm11_sc7_set_vcr(arm11, arm11->vcr));
  397. }
  398. /* activate all watchpoints and breakpoints */
  399. CHECK_RETVAL(arm11_leave_debug_state(arm11, true));
  400. arm11_add_IR(arm11, ARM11_RESTART, TAP_IDLE);
  401. CHECK_RETVAL(jtag_execute_queue());
  402. int i = 0;
  403. while (1) {
  404. CHECK_RETVAL(arm11_read_DSCR(arm11));
  405. LOG_DEBUG("DSCR %08x", (unsigned) arm11->dscr);
  406. if (arm11->dscr & DSCR_CORE_RESTARTED)
  407. break;
  408. int64_t then = 0;
  409. if (i == 1000)
  410. then = timeval_ms();
  411. if (i >= 1000) {
  412. if ((timeval_ms()-then) > 1000) {
  413. LOG_WARNING("Timeout (1000ms) waiting for instructions to complete");
  414. return ERROR_FAIL;
  415. }
  416. }
  417. i++;
  418. }
  419. target->debug_reason = DBG_REASON_NOTHALTED;
  420. if (!debug_execution)
  421. target->state = TARGET_RUNNING;
  422. else
  423. target->state = TARGET_DEBUG_RUNNING;
  424. CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_RESUMED));
  425. return ERROR_OK;
  426. }
  427. static int arm11_step(struct target *target, int current,
  428. target_addr_t address, int handle_breakpoints)
  429. {
  430. LOG_DEBUG("target->state: %s",
  431. target_state_name(target));
  432. if (target->state != TARGET_HALTED) {
  433. LOG_WARNING("target was not halted");
  434. return ERROR_TARGET_NOT_HALTED;
  435. }
  436. struct arm11_common *arm11 = target_to_arm11(target);
  437. address = arm11_nextpc(arm11, current, address);
  438. LOG_DEBUG("STEP PC %08" TARGET_PRIxADDR "%s", address, !current ? "!" : "");
  439. /** \todo TODO: Thumb not supported here */
  440. uint32_t next_instruction;
  441. CHECK_RETVAL(arm11_read_memory_word(arm11, address, &next_instruction));
  442. /* skip over BKPT */
  443. if ((next_instruction & 0xFFF00070) == 0xe1200070) {
  444. address = arm11_nextpc(arm11, 0, address + 4);
  445. LOG_DEBUG("Skipping BKPT %08" TARGET_PRIxADDR, address);
  446. }
  447. /* skip over Wait for interrupt / Standby
  448. * mcr 15, 0, r?, cr7, cr0, {4} */
  449. else if ((next_instruction & 0xFFFF0FFF) == 0xee070f90) {
  450. address = arm11_nextpc(arm11, 0, address + 4);
  451. LOG_DEBUG("Skipping WFI %08" TARGET_PRIxADDR, address);
  452. }
  453. /* ignore B to self */
  454. else if ((next_instruction & 0xFEFFFFFF) == 0xeafffffe)
  455. LOG_DEBUG("Not stepping jump to self");
  456. else {
  457. /** \todo TODO: check if break-/watchpoints make any sense at all in combination
  458. * with this. */
  459. /** \todo TODO: check if disabling IRQs might be a good idea here. Alternatively
  460. * the VCR might be something worth looking into. */
  461. /* Set up breakpoint for stepping */
  462. struct arm11_sc7_action brp[2];
  463. brp[0].write = 1;
  464. brp[0].address = ARM11_SC7_BVR0;
  465. brp[1].write = 1;
  466. brp[1].address = ARM11_SC7_BCR0;
  467. if (arm11->hardware_step) {
  468. /* Hardware single stepping ("instruction address
  469. * mismatch") is used if enabled. It's not quite
  470. * exactly "run one instruction"; "branch to here"
  471. * loops won't break, neither will some other cases,
  472. * but it's probably the best default.
  473. *
  474. * Hardware single stepping isn't supported on v6
  475. * debug modules. ARM1176 and v7 can support it...
  476. *
  477. * FIXME Thumb stepping likely needs to use 0x03
  478. * or 0xc0 byte masks, not 0x0f.
  479. */
  480. brp[0].value = address;
  481. brp[1].value = 0x1 | (3 << 1) | (0x0F << 5)
  482. | (0 << 14) | (0 << 16) | (0 << 20)
  483. | (2 << 21);
  484. } else {
  485. /* Sets a breakpoint on the next PC, as calculated
  486. * by instruction set simulation.
  487. *
  488. * REVISIT stepping Thumb on ARM1156 requires Thumb2
  489. * support from the simulator.
  490. */
  491. uint32_t next_pc;
  492. int retval;
  493. retval = arm_simulate_step(target, &next_pc);
  494. if (retval != ERROR_OK)
  495. return retval;
  496. brp[0].value = next_pc;
  497. brp[1].value = 0x1 | (3 << 1) | (0x0F << 5)
  498. | (0 << 14) | (0 << 16) | (0 << 20)
  499. | (0 << 21);
  500. }
  501. CHECK_RETVAL(arm11_sc7_run(arm11, brp, ARRAY_SIZE(brp)));
  502. /* resume */
  503. if (arm11->step_irq_enable)
  504. /* this disable should be redundant ... */
  505. arm11->dscr &= ~DSCR_INT_DIS;
  506. else
  507. arm11->dscr |= DSCR_INT_DIS;
  508. CHECK_RETVAL(arm11_leave_debug_state(arm11, handle_breakpoints));
  509. arm11_add_IR(arm11, ARM11_RESTART, TAP_IDLE);
  510. CHECK_RETVAL(jtag_execute_queue());
  511. /* wait for halt */
  512. int i = 0;
  513. while (1) {
  514. const uint32_t mask = DSCR_CORE_RESTARTED
  515. | DSCR_CORE_HALTED;
  516. CHECK_RETVAL(arm11_read_DSCR(arm11));
  517. LOG_DEBUG("DSCR %08x e", (unsigned) arm11->dscr);
  518. if ((arm11->dscr & mask) == mask)
  519. break;
  520. long long then = 0;
  521. if (i == 1000)
  522. then = timeval_ms();
  523. if (i >= 1000) {
  524. if ((timeval_ms()-then) > 1000) {
  525. LOG_WARNING(
  526. "Timeout (1000ms) waiting for instructions to complete");
  527. return ERROR_FAIL;
  528. }
  529. }
  530. i++;
  531. }
  532. /* clear breakpoint */
  533. CHECK_RETVAL(arm11_sc7_clear_vbw(arm11));
  534. /* save state */
  535. CHECK_RETVAL(arm11_debug_entry(arm11));
  536. /* restore default state */
  537. arm11->dscr &= ~DSCR_INT_DIS;
  538. }
  539. target->debug_reason = DBG_REASON_SINGLESTEP;
  540. CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED));
  541. return ERROR_OK;
  542. }
  543. static int arm11_assert_reset(struct target *target)
  544. {
  545. struct arm11_common *arm11 = target_to_arm11(target);
  546. if (!(target_was_examined(target))) {
  547. if (jtag_get_reset_config() & RESET_HAS_SRST)
  548. jtag_add_reset(0, 1);
  549. else {
  550. LOG_WARNING("Reset is not asserted because the target is not examined.");
  551. LOG_WARNING("Use a reset button or power cycle the target.");
  552. return ERROR_TARGET_NOT_EXAMINED;
  553. }
  554. } else {
  555. /* optionally catch reset vector */
  556. if (target->reset_halt && !(arm11->vcr & 1))
  557. CHECK_RETVAL(arm11_sc7_set_vcr(arm11, arm11->vcr | 1));
  558. /* Issue some kind of warm reset. */
  559. if (target_has_event_action(target, TARGET_EVENT_RESET_ASSERT))
  560. target_handle_event(target, TARGET_EVENT_RESET_ASSERT);
  561. else if (jtag_get_reset_config() & RESET_HAS_SRST) {
  562. /* REVISIT handle "pulls" cases, if there's
  563. * hardware that needs them to work.
  564. */
  565. jtag_add_reset(0, 1);
  566. } else {
  567. LOG_ERROR("%s: how to reset?", target_name(target));
  568. return ERROR_FAIL;
  569. }
  570. }
  571. /* registers are now invalid */
  572. register_cache_invalidate(arm11->arm.core_cache);
  573. target->state = TARGET_RESET;
  574. return ERROR_OK;
  575. }
  576. /*
  577. * - There is another bug in the arm11 core. (iMX31 specific again?)
  578. * When you generate an access to external logic (for example DDR
  579. * controller via AHB bus) and that block is not configured (perhaps
  580. * it is still held in reset), that transaction will never complete.
  581. * This will hang arm11 core but it will also hang JTAG controller.
  582. * Nothing short of srst assertion will bring it out of this.
  583. */
  584. static int arm11_deassert_reset(struct target *target)
  585. {
  586. struct arm11_common *arm11 = target_to_arm11(target);
  587. int retval;
  588. /* be certain SRST is off */
  589. jtag_add_reset(0, 0);
  590. /* WORKAROUND i.MX31 problems: SRST goofs the TAP, and resets
  591. * at least DSCR. OMAP24xx doesn't show that problem, though
  592. * SRST-only reset seems to be problematic for other reasons.
  593. * (Secure boot sequences being one likelihood!)
  594. */
  595. jtag_add_tlr();
  596. CHECK_RETVAL(arm11_poll(target));
  597. if (target->reset_halt) {
  598. if (target->state != TARGET_HALTED) {
  599. LOG_WARNING("%s: ran after reset and before halt ...",
  600. target_name(target));
  601. retval = target_halt(target);
  602. if (retval != ERROR_OK)
  603. return retval;
  604. }
  605. }
  606. /* maybe restore vector catch config */
  607. if (target->reset_halt && !(arm11->vcr & 1))
  608. CHECK_RETVAL(arm11_sc7_set_vcr(arm11, arm11->vcr));
  609. return ERROR_OK;
  610. }
  611. /* target memory access
  612. * size: 1 = byte (8bit), 2 = half-word (16bit), 4 = word (32bit)
  613. * count: number of items of <size>
  614. *
  615. * arm11_config_memrw_no_increment - in the future we may want to be able
  616. * to read/write a range of data to a "port". a "port" is an action on
  617. * read memory address for some peripheral.
  618. */
  619. static int arm11_read_memory_inner(struct target *target,
  620. uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer,
  621. bool arm11_config_memrw_no_increment)
  622. {
  623. /** \todo TODO: check if buffer cast to uint32_t* and uint16_t* might cause alignment
  624. *problems */
  625. int retval;
  626. if (target->state != TARGET_HALTED) {
  627. LOG_WARNING("target was not halted");
  628. return ERROR_TARGET_NOT_HALTED;
  629. }
  630. LOG_DEBUG("ADDR %08" PRIx32 " SIZE %08" PRIx32 " COUNT %08" PRIx32 "",
  631. address,
  632. size,
  633. count);
  634. struct arm11_common *arm11 = target_to_arm11(target);
  635. retval = arm11_run_instr_data_prepare(arm11);
  636. if (retval != ERROR_OK)
  637. return retval;
  638. /* MRC p14,0,r0,c0,c5,0 */
  639. retval = arm11_run_instr_data_to_core1(arm11, 0xee100e15, address);
  640. if (retval != ERROR_OK)
  641. return retval;
  642. switch (size) {
  643. case 1:
  644. arm11->arm.core_cache->reg_list[1].dirty = true;
  645. for (size_t i = 0; i < count; i++) {
  646. /* ldrb r1, [r0], #1 */
  647. /* ldrb r1, [r0] */
  648. CHECK_RETVAL(arm11_run_instr_no_data1(arm11,
  649. !arm11_config_memrw_no_increment ? 0xe4d01001 : 0xe5d01000));
  650. uint32_t res;
  651. /* MCR p14,0,R1,c0,c5,0 */
  652. CHECK_RETVAL(arm11_run_instr_data_from_core(arm11, 0xEE001E15, &res, 1));
  653. *buffer++ = res;
  654. }
  655. break;
  656. case 2:
  657. {
  658. arm11->arm.core_cache->reg_list[1].dirty = true;
  659. for (size_t i = 0; i < count; i++) {
  660. /* ldrh r1, [r0], #2 */
  661. CHECK_RETVAL(arm11_run_instr_no_data1(arm11,
  662. !arm11_config_memrw_no_increment ? 0xe0d010b2 : 0xe1d010b0));
  663. uint32_t res;
  664. /* MCR p14,0,R1,c0,c5,0 */
  665. CHECK_RETVAL(arm11_run_instr_data_from_core(arm11, 0xEE001E15, &res, 1));
  666. uint16_t svalue = res;
  667. memcpy(buffer + i * sizeof(uint16_t), &svalue, sizeof(uint16_t));
  668. }
  669. break;
  670. }
  671. case 4:
  672. {
  673. uint32_t instr = !arm11_config_memrw_no_increment ? 0xecb05e01 : 0xed905e00;
  674. /** \todo TODO: buffer cast to uint32_t* causes alignment warnings */
  675. uint32_t *words = (uint32_t *)(void *)buffer;
  676. /* LDC p14,c5,[R0],#4 */
  677. /* LDC p14,c5,[R0] */
  678. CHECK_RETVAL(arm11_run_instr_data_from_core(arm11, instr, words, count));
  679. break;
  680. }
  681. }
  682. return arm11_run_instr_data_finish(arm11);
  683. }
  684. static int arm11_read_memory(struct target *target,
  685. target_addr_t address,
  686. uint32_t size,
  687. uint32_t count,
  688. uint8_t *buffer)
  689. {
  690. return arm11_read_memory_inner(target, address, size, count, buffer, false);
  691. }
  692. /*
  693. * no_increment - in the future we may want to be able
  694. * to read/write a range of data to a "port". a "port" is an action on
  695. * read memory address for some peripheral.
  696. */
  697. static int arm11_write_memory_inner(struct target *target,
  698. uint32_t address, uint32_t size,
  699. uint32_t count, const uint8_t *buffer,
  700. bool no_increment)
  701. {
  702. int retval;
  703. if (target->state != TARGET_HALTED) {
  704. LOG_WARNING("target was not halted");
  705. return ERROR_TARGET_NOT_HALTED;
  706. }
  707. LOG_DEBUG("ADDR %08" PRIx32 " SIZE %08" PRIx32 " COUNT %08" PRIx32 "",
  708. address,
  709. size,
  710. count);
  711. struct arm11_common *arm11 = target_to_arm11(target);
  712. retval = arm11_run_instr_data_prepare(arm11);
  713. if (retval != ERROR_OK)
  714. return retval;
  715. /* load r0 with buffer address
  716. * MRC p14,0,r0,c0,c5,0 */
  717. retval = arm11_run_instr_data_to_core1(arm11, 0xee100e15, address);
  718. if (retval != ERROR_OK)
  719. return retval;
  720. /* burst writes are not used for single words as those may well be
  721. * reset init script writes.
  722. *
  723. * The other advantage is that as burst writes are default, we'll
  724. * now exercise both burst and non-burst code paths with the
  725. * default settings, increasing code coverage.
  726. */
  727. bool burst = arm11->memwrite_burst && (count > 1);
  728. switch (size) {
  729. case 1:
  730. {
  731. arm11->arm.core_cache->reg_list[1].dirty = true;
  732. for (size_t i = 0; i < count; i++) {
  733. /* load r1 from DCC with byte data */
  734. /* MRC p14,0,r1,c0,c5,0 */
  735. retval = arm11_run_instr_data_to_core1(arm11, 0xee101e15, *buffer++);
  736. if (retval != ERROR_OK)
  737. return retval;
  738. /* write r1 to memory */
  739. /* strb r1, [r0], #1 */
  740. /* strb r1, [r0] */
  741. retval = arm11_run_instr_no_data1(arm11,
  742. !no_increment ? 0xe4c01001 : 0xe5c01000);
  743. if (retval != ERROR_OK)
  744. return retval;
  745. }
  746. break;
  747. }
  748. case 2:
  749. {
  750. arm11->arm.core_cache->reg_list[1].dirty = true;
  751. for (size_t i = 0; i < count; i++) {
  752. uint16_t value;
  753. memcpy(&value, buffer + i * sizeof(uint16_t), sizeof(uint16_t));
  754. /* load r1 from DCC with halfword data */
  755. /* MRC p14,0,r1,c0,c5,0 */
  756. retval = arm11_run_instr_data_to_core1(arm11, 0xee101e15, value);
  757. if (retval != ERROR_OK)
  758. return retval;
  759. /* write r1 to memory */
  760. /* strh r1, [r0], #2 */
  761. /* strh r1, [r0] */
  762. retval = arm11_run_instr_no_data1(arm11,
  763. !no_increment ? 0xe0c010b2 : 0xe1c010b0);
  764. if (retval != ERROR_OK)
  765. return retval;
  766. }
  767. break;
  768. }
  769. case 4: {
  770. /* stream word data through DCC directly to memory */
  771. /* increment: STC p14,c5,[R0],#4 */
  772. /* no increment: STC p14,c5,[R0]*/
  773. uint32_t instr = !no_increment ? 0xeca05e01 : 0xed805e00;
  774. /** \todo TODO: buffer cast to uint32_t* causes alignment warnings */
  775. uint32_t *words = (uint32_t *)(void *)buffer;
  776. /* "burst" here just means trusting each instruction executes
  777. * fully before we run the next one: per-word roundtrips, to
  778. * check the Ready flag, are not used.
  779. */
  780. if (!burst)
  781. retval = arm11_run_instr_data_to_core(arm11,
  782. instr, words, count);
  783. else
  784. retval = arm11_run_instr_data_to_core_noack(arm11,
  785. instr, words, count);
  786. if (retval != ERROR_OK)
  787. return retval;
  788. break;
  789. }
  790. }
  791. /* r0 verification */
  792. if (!no_increment) {
  793. uint32_t r0;
  794. /* MCR p14,0,R0,c0,c5,0 */
  795. retval = arm11_run_instr_data_from_core(arm11, 0xEE000E15, &r0, 1);
  796. if (retval != ERROR_OK)
  797. return retval;
  798. if (address + size * count != r0) {
  799. LOG_ERROR("Data transfer failed. Expected end "
  800. "address 0x%08x, got 0x%08x",
  801. (unsigned) (address + size * count),
  802. (unsigned) r0);
  803. if (burst)
  804. LOG_ERROR(
  805. "use 'arm11 memwrite burst disable' to disable fast burst mode");
  806. if (arm11->memwrite_error_fatal)
  807. return ERROR_FAIL;
  808. }
  809. }
  810. return arm11_run_instr_data_finish(arm11);
  811. }
  812. static int arm11_write_memory(struct target *target,
  813. target_addr_t address, uint32_t size,
  814. uint32_t count, const uint8_t *buffer)
  815. {
  816. /* pointer increment matters only for multi-unit writes ...
  817. * not e.g. to a "reset the chip" controller.
  818. */
  819. return arm11_write_memory_inner(target, address, size,
  820. count, buffer, count == 1);
  821. }
  822. /* target break-/watchpoint control
  823. * rw: 0 = write, 1 = read, 2 = access
  824. */
  825. static int arm11_add_breakpoint(struct target *target,
  826. struct breakpoint *breakpoint)
  827. {
  828. struct arm11_common *arm11 = target_to_arm11(target);
  829. #if 0
  830. if (breakpoint->type == BKPT_SOFT) {
  831. LOG_INFO("sw breakpoint requested, but software breakpoints not enabled");
  832. return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
  833. }
  834. #endif
  835. if (!arm11->free_brps) {
  836. LOG_DEBUG("no breakpoint unit available for hardware breakpoint");
  837. return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
  838. }
  839. if (breakpoint->length != 4) {
  840. LOG_DEBUG("only breakpoints of four bytes length supported");
  841. return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
  842. }
  843. arm11->free_brps--;
  844. return ERROR_OK;
  845. }
  846. static int arm11_remove_breakpoint(struct target *target,
  847. struct breakpoint *breakpoint)
  848. {
  849. struct arm11_common *arm11 = target_to_arm11(target);
  850. arm11->free_brps++;
  851. return ERROR_OK;
  852. }
  853. static int arm11_target_create(struct target *target, Jim_Interp *interp)
  854. {
  855. struct arm11_common *arm11;
  856. if (target->tap == NULL)
  857. return ERROR_FAIL;
  858. if (target->tap->ir_length != 5) {
  859. LOG_ERROR("'target arm11' expects IR LENGTH = 5");
  860. return ERROR_COMMAND_SYNTAX_ERROR;
  861. }
  862. arm11 = calloc(1, sizeof *arm11);
  863. if (!arm11)
  864. return ERROR_FAIL;
  865. arm11->arm.core_type = ARM_MODE_ANY;
  866. arm_init_arch_info(target, &arm11->arm);
  867. arm11->jtag_info.tap = target->tap;
  868. arm11->jtag_info.scann_size = 5;
  869. arm11->jtag_info.scann_instr = ARM11_SCAN_N;
  870. arm11->jtag_info.cur_scan_chain = ~0; /* invalid/unknown */
  871. arm11->jtag_info.intest_instr = ARM11_INTEST;
  872. arm11->memwrite_burst = true;
  873. arm11->memwrite_error_fatal = true;
  874. return ERROR_OK;
  875. }
  876. static int arm11_init_target(struct command_context *cmd_ctx,
  877. struct target *target)
  878. {
  879. /* Initialize anything we can set up without talking to the target */
  880. return ERROR_OK;
  881. }
  882. /* talk to the target and set things up */
  883. static int arm11_examine(struct target *target)
  884. {
  885. int retval;
  886. char *type;
  887. struct arm11_common *arm11 = target_to_arm11(target);
  888. uint32_t didr, device_id;
  889. uint8_t implementor;
  890. /* FIXME split into do-first-time and do-every-time logic ... */
  891. /* check IDCODE */
  892. arm11_add_IR(arm11, ARM11_IDCODE, ARM11_TAP_DEFAULT);
  893. struct scan_field idcode_field;
  894. arm11_setup_field(arm11, 32, NULL, &device_id, &idcode_field);
  895. arm11_add_dr_scan_vc(arm11->arm.target->tap, 1, &idcode_field, TAP_DRPAUSE);
  896. /* check DIDR */
  897. arm11_add_debug_SCAN_N(arm11, 0x00, ARM11_TAP_DEFAULT);
  898. arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT);
  899. struct scan_field chain0_fields[2];
  900. arm11_setup_field(arm11, 32, NULL, &didr, chain0_fields + 0);
  901. arm11_setup_field(arm11, 8, NULL, &implementor, chain0_fields + 1);
  902. arm11_add_dr_scan_vc(arm11->arm.target->tap, ARRAY_SIZE(
  903. chain0_fields), chain0_fields, TAP_IDLE);
  904. CHECK_RETVAL(jtag_execute_queue());
  905. /* assume the manufacturer id is ok; check the part # */
  906. switch ((device_id >> 12) & 0xFFFF) {
  907. case 0x7B36:
  908. type = "ARM1136";
  909. break;
  910. case 0x7B37:
  911. type = "ARM11 MPCore";
  912. break;
  913. case 0x7B56:
  914. type = "ARM1156";
  915. break;
  916. case 0x7B76:
  917. arm11->arm.core_type = ARM_MODE_MON;
  918. /* NOTE: could default arm11->hardware_step to true */
  919. type = "ARM1176";
  920. break;
  921. default:
  922. LOG_ERROR("unexpected ARM11 ID code");
  923. return ERROR_FAIL;
  924. }
  925. LOG_INFO("found %s", type);
  926. /* unlikely this could ever fail, but ... */
  927. switch ((didr >> 16) & 0x0F) {
  928. case ARM11_DEBUG_V6:
  929. case ARM11_DEBUG_V61: /* supports security extensions */
  930. break;
  931. default:
  932. LOG_ERROR("Only ARM v6 and v6.1 debug supported.");
  933. return ERROR_FAIL;
  934. }
  935. arm11->brp = ((didr >> 24) & 0x0F) + 1;
  936. /** \todo TODO: reserve one brp slot if we allow breakpoints during step */
  937. arm11->free_brps = arm11->brp;
  938. LOG_DEBUG("IDCODE %08" PRIx32 " IMPLEMENTOR %02x DIDR %08" PRIx32,
  939. device_id, implementor, didr);
  940. /* Build register cache "late", after target_init(), since we
  941. * want to know if this core supports Secure Monitor mode.
  942. */
  943. if (!target_was_examined(target))
  944. CHECK_RETVAL(arm11_dpm_init(arm11, didr));
  945. /* as a side-effect this reads DSCR and thus
  946. * clears the ARM11_DSCR_STICKY_PRECISE_DATA_ABORT / Sticky Precise Data Abort Flag
  947. * as suggested by the spec.
  948. */
  949. retval = arm11_check_init(arm11);
  950. if (retval != ERROR_OK)
  951. return retval;
  952. /* ETM on ARM11 still uses original scanchain 6 access mode */
  953. if (arm11->arm.etm && !target_was_examined(target)) {
  954. *register_get_last_cache_p(&target->reg_cache) =
  955. etm_build_reg_cache(target, &arm11->jtag_info,
  956. arm11->arm.etm);
  957. CHECK_RETVAL(etm_setup(target));
  958. }
  959. target_set_examined(target);
  960. return ERROR_OK;
  961. }
  962. #define ARM11_BOOL_WRAPPER(name, print_name) \
  963. COMMAND_HANDLER(arm11_handle_bool_ ## name) \
  964. { \
  965. struct target *target = get_current_target(CMD_CTX); \
  966. struct arm11_common *arm11 = target_to_arm11(target); \
  967. \
  968. return CALL_COMMAND_HANDLER(handle_command_parse_bool, \
  969. &arm11->name, print_name); \
  970. }
  971. ARM11_BOOL_WRAPPER(memwrite_burst, "memory write burst mode")
  972. ARM11_BOOL_WRAPPER(memwrite_error_fatal, "fatal error mode for memory writes")
  973. ARM11_BOOL_WRAPPER(step_irq_enable, "IRQs while stepping")
  974. ARM11_BOOL_WRAPPER(hardware_step, "hardware single step")
  975. /* REVISIT handle the VCR bits like other ARMs: use symbols for
  976. * input and output values.
  977. */
  978. COMMAND_HANDLER(arm11_handle_vcr)
  979. {
  980. struct target *target = get_current_target(CMD_CTX);
  981. struct arm11_common *arm11 = target_to_arm11(target);
  982. switch (CMD_ARGC) {
  983. case 0:
  984. break;
  985. case 1:
  986. COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], arm11->vcr);
  987. break;
  988. default:
  989. return ERROR_COMMAND_SYNTAX_ERROR;
  990. }
  991. LOG_INFO("VCR 0x%08" PRIx32 "", arm11->vcr);
  992. return ERROR_OK;
  993. }
  994. static const struct command_registration arm11_mw_command_handlers[] = {
  995. {
  996. .name = "burst",
  997. .handler = arm11_handle_bool_memwrite_burst,
  998. .mode = COMMAND_ANY,
  999. .help = "Display or modify flag controlling potentially "
  1000. "risky fast burst mode (default: enabled)",
  1001. .usage = "['enable'|'disable']",
  1002. },
  1003. {
  1004. .name = "error_fatal",
  1005. .handler = arm11_handle_bool_memwrite_error_fatal,
  1006. .mode = COMMAND_ANY,
  1007. .help = "Display or modify flag controlling transfer "
  1008. "termination on transfer errors"
  1009. " (default: enabled)",
  1010. .usage = "['enable'|'disable']",
  1011. },
  1012. COMMAND_REGISTRATION_DONE
  1013. };
  1014. static const struct command_registration arm11_any_command_handlers[] = {
  1015. {
  1016. /* "hardware_step" is only here to check if the default
  1017. * simulate + breakpoint implementation is broken.
  1018. * TEMPORARY! NOT DOCUMENTED! */
  1019. .name = "hardware_step",
  1020. .handler = arm11_handle_bool_hardware_step,
  1021. .mode = COMMAND_ANY,
  1022. .help = "DEBUG ONLY - Hardware single stepping"
  1023. " (default: disabled)",
  1024. .usage = "['enable'|'disable']",
  1025. },
  1026. {
  1027. .name = "memwrite",
  1028. .mode = COMMAND_ANY,
  1029. .help = "memwrite command group",
  1030. .usage = "",
  1031. .chain = arm11_mw_command_handlers,
  1032. },
  1033. {
  1034. .name = "step_irq_enable",
  1035. .handler = arm11_handle_bool_step_irq_enable,
  1036. .mode = COMMAND_ANY,
  1037. .help = "Display or modify flag controlling interrupt "
  1038. "enable while stepping (default: disabled)",
  1039. .usage = "['enable'|'disable']",
  1040. },
  1041. {
  1042. .name = "vcr",
  1043. .handler = arm11_handle_vcr,
  1044. .mode = COMMAND_ANY,
  1045. .help = "Display or modify Vector Catch Register",
  1046. .usage = "[value]",
  1047. },
  1048. COMMAND_REGISTRATION_DONE
  1049. };
  1050. static const struct command_registration arm11_command_handlers[] = {
  1051. {
  1052. .chain = arm_command_handlers,
  1053. },
  1054. {
  1055. .chain = etm_command_handlers,
  1056. },
  1057. {
  1058. .name = "arm11",
  1059. .mode = COMMAND_ANY,
  1060. .help = "ARM11 command group",
  1061. .usage = "",
  1062. .chain = arm11_any_command_handlers,
  1063. },
  1064. COMMAND_REGISTRATION_DONE
  1065. };
  1066. /** Holds methods for ARM11xx targets. */
  1067. struct target_type arm11_target = {
  1068. .name = "arm11",
  1069. .poll = arm11_poll,
  1070. .arch_state = arm11_arch_state,
  1071. .halt = arm11_halt,
  1072. .resume = arm11_resume,
  1073. .step = arm11_step,
  1074. .assert_reset = arm11_assert_reset,
  1075. .deassert_reset = arm11_deassert_reset,
  1076. .get_gdb_reg_list = arm_get_gdb_reg_list,
  1077. .read_memory = arm11_read_memory,
  1078. .write_memory = arm11_write_memory,
  1079. .checksum_memory = arm_checksum_memory,
  1080. .blank_check_memory = arm_blank_check_memory,
  1081. .add_breakpoint = arm11_add_breakpoint,
  1082. .remove_breakpoint = arm11_remove_breakpoint,
  1083. .run_algorithm = armv4_5_run_algorithm,
  1084. .commands = arm11_command_handlers,
  1085. .target_create = arm11_target_create,
  1086. .init_target = arm11_init_target,
  1087. .examine = arm11_examine,
  1088. };