#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_instr.h"
ARM7TDMI / ARM9TDMI Interface (support functions)
void jtag_supp_int2bitstr_MSB_First | ( | int | len, | |
int32_t | val, | |||
char * | str | |||
) |
support function to create a bit string with MSB first
e.g.
len = 4
val = 12 = 0xC = 0b1100
str = "1100"
len | bit string length | |
val | original 32-bit integer value | |
str | pointer to bit string |
Referenced by jt_str91xflash_ReadSector(), jt_str91xflash_WriteSector(), jtag_arm920_CP15Interpret(), jtag_arm920_CP15PhysRegRead(), jtag_arm920_CP15PhysRegWrite(), jtag_arm926_CP15RegRead(), jtag_arm926_CP15RegWrite(), jtag_arm966_CP15RegRead(), jtag_arm966_CP15RegWrite(), jtag_arm9_mov_chain1_data(), jtag_arm_IceRT_RegRead(), jtag_arm_IceRT_RegRead_Once(), jtag_arm_IceRT_RegWrite(), jtag_arm_IceRT_RegWrite_getPrevData(), jtag_arm_set_chain(), jtag_cortex_apacc_RegRead(), jtag_cortex_apacc_RegWrite(), jtag_cortex_dpacc_RegRead(), and jtag_cortex_dpacc_RegWrite().
void jtag_supp_int2bitstr_LSB_First | ( | int | len, | |
int32_t | val, | |||
char * | str | |||
) |
support function to create a bit string with LSB first
e.g.
len = 4
val = 12 = 0xC = 0b1100
str = "0011"
len | bit string length | |
val | original 32-bit integer value | |
str | pointer to bit string |
Referenced by jtag_arm720_CP15DataExchange(), jtag_arm720_CP15InstrReg(), jtag_arm7_mov_chain1_data(), and jtag_arm9_mov_chain1_data().
void jtag_supp_bitstr2int_LSB_First | ( | int | len, | |
int32_t * | val, | |||
char * | str | |||
) |
support function to generate an integer value out of the bit string e.g.
len = 4
str = "0011"
val = 12 = 0xC = 0b1100
len | bit string length | |
val | pointer to 32-bit integer value | |
str | pointer to source bit string |
Referenced by jtag_arm720_CP15DataExchange(), jtag_arm720_CP15InstrReg(), jtag_arm7_mov_chain1_data(), and jtag_arm9_mov_chain1_data().
void jtag_supp_bitstr2int_MSB_First | ( | int | len, | |
int32_t * | val, | |||
char * | str | |||
) |
support function to generate an integer value out of the bit string e.g.
len = 4
str = "1100"
val = 12 = 0xC = 0b1100
len | bit string length | |
val | pointer to 32-bit integer value | |
str | pointer to source bit string |
Referenced by jt_str91xflash_GetConfig(), jt_str91xflash_ReadSector(), jtag_arm920_CP15PhysRegRead(), jtag_arm926_CP15RegRead(), jtag_arm966_CP15RegRead(), jtag_arm9_mov_chain1_data(), jtag_arm_IceRT_RegRead(), jtag_arm_IceRT_RegRead_Once(), jtag_arm_IceRT_RegWrite_getPrevData(), jtag_cortex_apacc_RegRead(), jtag_cortex_apacc_RegWrite(), jtag_cortex_dpacc_RegRead(), jtag_cortex_dpacc_RegWrite(), jtag_identify_devices(), tap_discover_chain_usb_ftdi(), and tap_discover_chain_usb_jlink().
int jtag_arm_identify | ( | void | ) |
support function to check if this is the correct device
- |
1 | if well known device | |
<= | 0 no device or unknown device |
References jtag_identify_devices().
Referenced by gdb_restart(), and jtag_test().
int is_arm_store_instr | ( | uint32_t | step_instr | ) |
support function to check type of instruction
check if this is a kind of ARM store instruction
step_instr | intruction to check |
1 | true | |
0 | false |
References ARM_STORE, ARM_STORE_COPROCESSOR_REG, ARM_STORE_COPROCESSOR_REG_MSK, ARM_STORE_MISC, ARM_STORE_MISC_MSK, ARM_STORE_MSK, ARM_STORE_MULTIPLE, and ARM_STORE_MULTIPLE_MSK.
Referenced by gdb_action_step().
int is_thumb_store_instr | ( | uint32_t | step_instr | ) |
support function to check type of instruction
check if this is a kind of THUMB store instruction
step_instr | instruction to check |
1 | true | |
0 | false |
References THUMB_STORE_A_1, THUMB_STORE_A_3, THUMB_STORE_A_BYTE_1, THUMB_STORE_A_HALF_1, THUMB_STORE_A_MSK, THUMB_STORE_A_MULTIPLE, THUMB_STORE_B_2, THUMB_STORE_B_BYTE_2, THUMB_STORE_B_HALF_2, THUMB_STORE_B_MSK, and THUMB_STORE_B_PUSH.
Referenced by gdb_action_step().
int is_arm_bl_instr | ( | uint32_t | step_instr | ) |
support function to check type of instruction
check if this is an ARM branch and link instruction
step_instr | instruction to check |
1 | true | |
0 | false |
References ARM_BL_INSTR, ARM_BL_MSK, ARM_BLX_1_INSTR, ARM_BLX_1_MSK, ARM_BLX_2_INSTR, ARM_BLX_2_MSK, and jt_arm_condition_pass().
Referenced by gdb_action_step(), and gdb_handle_exception().
int is_arm_load_banked_regs_instr | ( | uint32_t | step_instr | ) |
support function to check type of instruction
check if this is will change the banked registers
step_instr | instruction to check |
1 | true | |
0 | false |
References ARM_LOAD_MULTIPLE_BANK, ARM_LOAD_MULTIPLE_BANK_MSK, ARM_MSR_SPSR_IMM, ARM_MSR_SPSR_MSK, ARM_MSR_SPSR_REG, reg_set::CPSR, CPU, CPU_CPSR_MODE_ABORT, CPU_CPSR_MODE_FIQ, CPU_CPSR_MODE_FLAGS, CPU_CPSR_MODE_IRQ, CPU_CPSR_MODE_SVC, CPU_CPSR_MODE_UNDEF_INSTR, and jt_arm_condition_pass().
Referenced by jtag_arm_Step().
int jt_arm_condition_pass | ( | uint32_t | step_instr | ) |
check ARM condition flags of ARM instruction
cpsr flags: N Z C V
step_instr | intruction to check |
1 | pass (intr. will be executed) | |
0 | fail |
References reg_set::CPSR, CPU, and jt_arm_condition_check().
Referenced by arm_step_emu(), is_arm_bl_instr(), is_arm_load_banked_regs_instr(), jt_arm_instr_access_mem(), jt_arm_instr_bx_workaround(), jt_arm_instr_modifys_PC(), jt_thumb_instr_modifys_PC(), and thumb_step_emu().
int jt_arm_condition_check | ( | uint32_t | condition, | |
uint32_t | cpsr | |||
) |
References CPU_CPSR_FLAG_CARRY, CPU_CPSR_FLAG_NEGATIVE, CPU_CPSR_FLAG_OVERFLOW, and CPU_CPSR_FLAG_ZERO.
Referenced by doCmdSequence(), and jt_arm_condition_pass().
int jt_arm_instr_modifys_PC | ( | uint32_t | step_instr | ) |
support function to check if the given instruction will modify the program counter
step_instr | instruction to check |
1 | true | |
0 | false |
References jt_arm_condition_pass().
Referenced by gdb_action_step(), gdb_handle_exception(), jtag_arm7_Step(), and jtag_arm9_Step().
int jt_thumb_instr_modifys_PC | ( | uint32_t | step_instr | ) |
support function to check if the given instruction will modify the program counter
step_instr | intruction to check |
1 | true | |
0 | false |
References jt_arm_condition_pass().
Referenced by gdb_action_step(), gdb_handle_exception(), jtag_arm7_Step(), and jtag_arm9_Step().
int jt_arm_instr_access_mem | ( | uint32_t | step_instr | ) |
check if the ARM instruction is doing an access to the Memory.
step_instr | intruction to check |
1 | true | |
0 | false |
References jt_arm_condition_pass().
Referenced by jtag_arm7_Step(), and jtag_arm9_Step().
int jt_thumb_instr_access_mem | ( | uint32_t | step_instr | ) |
check if the THUMB instruction is doing an access to the Memory.
step_instr | intruction to check |
1 | true | |
0 | false |
Referenced by jtag_arm7_Step().
int jt_arm_instr_bx_workaround | ( | uint32_t | step_instr | ) |
check if this is the bx instruction and if so do the bx workaround, now
step_instr | intruction to check |
1 | true | |
0 | false |
References reg_set::CPSR, CPU, jt_arm_condition_pass(), reg_set::Regs::r, and reg_set::regs.
Referenced by gdb_action_step().
int jt_thumb_instr_bx_workaround | ( | uint32_t | step_instr | ) |
check if this is the bx instruction and if so do the bx workaround, now
step_instr | intruction to check |
1 | true | |
0 | false |
References reg_set::CPSR, CPU, reg_set::Regs::r, and reg_set::regs.
Referenced by gdb_action_step().