OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | swbp_mem_patch |
struct | x86_32_common |
struct | x86_32_dbg_reg |
Macros | |
#define | BYTE 1 |
#define | CR0_CD ((uint32_t)0x40000000) /* Cache Disable */ |
#define | CR0_NW ((uint32_t)0x20000000) /* Non Write-Through */ |
#define | CR0_PE ((uint32_t)0x00000001) /* Protected Mode Enable */ |
#define | CR0_PG ((uint32_t)0x80000000) /* Paging Enable */ |
#define | CSAR_D ((uint32_t)0x00400000) |
#define | CSAR_DPL ((uint32_t)0x00006000) |
#define | DR6_BRKDETECT_0 ((uint32_t)0x00000001) /* B0 through B3 */ |
#define | DR6_BRKDETECT_1 ((uint32_t)0x00000002) /* breakpoint condition detected */ |
#define | DR6_BRKDETECT_2 ((uint32_t)0x00000004) |
#define | DR6_BRKDETECT_3 ((uint32_t)0x00000008) |
#define | DR7_BP_EXECUTE 0 /* 00 - only on instruction execution*/ |
#define | DR7_BP_FREE(val, regnum) ((val & (3 << (DR7_ENABLE_SIZE * (regnum)))) == 0) |
#define | DR7_BP_LENGTH_1 0 /* 00 - 1 byte length */ |
#define | DR7_BP_LENGTH_2 1 /* 01 - 2 byte length */ |
#define | DR7_BP_LENGTH_4 3 /* 11 - 4 byte length */ |
#define | DR7_BP_READWRITE 3 /* on data read or data write */ |
#define | DR7_BP_WRITE 1 /* 01 - only on data writes */ |
#define | DR7_ENABLE_SIZE 2 /* 2 bits per debug reg */ |
#define | DR7_G_ENABLE_SHIFT 1 |
#define | DR7_GLOBAL_DISABLE(val, regnum) (val &= ~(3 << (DR7_ENABLE_SIZE * (regnum)))) |
#define | DR7_GLOBAL_ENABLE(val, regnum) (val |= (1 << (DR7_G_ENABLE_SHIFT + (DR7_ENABLE_SIZE * (regnum))))) |
#define | DR7_LENGTH_SHIFT 18 |
#define | DR7_RESET_RWLEN_BITS(val, regnum) (val &= ~(0x0f << (DR7_RW_SHIFT + DR7_RW_LEN_SIZE * (regnum)))) |
#define | DR7_RW_LEN_SIZE 4 |
#define | DR7_RW_SHIFT 16 |
#define | DR7_SET_ACCESS(val, regnum) (val |= (DR7_BP_READWRITE << (DR7_RW_SHIFT + DR7_RW_LEN_SIZE * (regnum)))) |
#define | DR7_SET_EXE(val, regnum) (val &= ~(0x0f << (DR7_RW_SHIFT + DR7_RW_LEN_SIZE * (regnum)))) |
#define | DR7_SET_LENGTH(val, regnum, len) |
#define | DR7_SET_WRITE(val, regnum) (val |= (DR7_BP_WRITE << (DR7_RW_SHIFT + DR7_RW_LEN_SIZE * (regnum)))) |
#define | DWORD 4 |
#define | EFLAGS_IF ((uint32_t)0x00000200) /* Interrupt Flag */ |
#define | EFLAGS_RF ((uint32_t)0x00010000) /* Resume Flag */ |
#define | EFLAGS_TF ((uint32_t)0x00000100) /* Trap Flag */ |
#define | EFLAGS_VM86 ((uint32_t)0x00020000) /* Virtual 8086 Mode */ |
#define | MAX_DEBUG_REGS 4 |
#define | MAX_SW_BPTS 20 |
#define | NUM_PM_REGS 18 /* regs used in save/restore */ |
#define | PM_DR6 ((uint32_t)0xFFFF0FF0) |
#define | SSAR_DPL ((uint32_t)0x00006000) |
#define | SW_BP_OPCODE 0xf1 |
#define | WORD 2 |
#define | X86_32_COMMON_MAGIC 0x86328632U |
Enumerations | |
enum | { EAX = 0 , ECX , EDX , EBX , ESP , EBP , ESI , EDI , EIP , EFLAGS , CS , SS , DS , ES , FS , GS , ST0 , ST1 , ST2 , ST3 , ST4 , ST5 , ST6 , ST7 , FCTRL , FSTAT , FTAG , FISEG , FIOFF , FOSEG , FOOFF , FOP , CR0 , CR2 , CR3 , CR4 , DR0 , DR1 , DR2 , DR3 , DR6 , DR7 , IDTB , IDTL , IDTAR , GDTB , GDTL , GDTAR , TR , LDTR , LDTB , LDTL , LDTAR , CSB , CSL , CSAR , DSB , DSL , DSAR , ESB , ESL , ESAR , FSB , FSL , FSAR , GSB , GSL , GSAR , SSB , SSL , SSAR , TSSB , TSSL , TSSAR , PMCR } |
enum | { MEMRDB32 = 0 , MEMRDB16 , MEMRDH32 , MEMRDH16 , MEMRDW32 , MEMRDW16 , MEMWRB32 , MEMWRB16 , MEMWRH32 , MEMWRH16 , MEMWRW32 , MEMWRW16 , IORDB32 , IORDB16 , IORDH32 , IORDH16 , IORDW32 , IORDW16 , IOWRB32 , IOWRB16 , IOWRH32 , IOWRH16 , IOWRW32 , IOWRW16 , SRAMACCESS , SRAM2PDR , PDR2SRAM , WBINVD } |
enum | x86_core_type { LMT1 , LMT3_5 } |
Variables | |
const struct command_registration | x86_32_command_handlers [] |
#define BYTE 1 |
Definition at line 31 of file x86_32_common.h.
#define CR0_CD ((uint32_t)0x40000000) /* Cache Disable */ |
Definition at line 46 of file x86_32_common.h.
#define CR0_NW ((uint32_t)0x20000000) /* Non Write-Through */ |
Definition at line 45 of file x86_32_common.h.
#define CR0_PE ((uint32_t)0x00000001) /* Protected Mode Enable */ |
Definition at line 44 of file x86_32_common.h.
#define CR0_PG ((uint32_t)0x80000000) /* Paging Enable */ |
Definition at line 47 of file x86_32_common.h.
#define CSAR_D ((uint32_t)0x00400000) |
Definition at line 41 of file x86_32_common.h.
#define CSAR_DPL ((uint32_t)0x00006000) |
Definition at line 40 of file x86_32_common.h.
#define DR6_BRKDETECT_0 ((uint32_t)0x00000001) /* B0 through B3 */ |
Definition at line 52 of file x86_32_common.h.
#define DR6_BRKDETECT_1 ((uint32_t)0x00000002) /* breakpoint condition detected */ |
Definition at line 53 of file x86_32_common.h.
#define DR6_BRKDETECT_2 ((uint32_t)0x00000004) |
Definition at line 54 of file x86_32_common.h.
#define DR6_BRKDETECT_3 ((uint32_t)0x00000008) |
Definition at line 55 of file x86_32_common.h.
#define DR7_BP_EXECUTE 0 /* 00 - only on instruction execution*/ |
Definition at line 262 of file x86_32_common.h.
#define DR7_BP_FREE | ( | val, | |
regnum | |||
) | ((val & (3 << (DR7_ENABLE_SIZE * (regnum)))) == 0) |
Definition at line 276 of file x86_32_common.h.
#define DR7_BP_LENGTH_1 0 /* 00 - 1 byte length */ |
Definition at line 266 of file x86_32_common.h.
#define DR7_BP_LENGTH_2 1 /* 01 - 2 byte length */ |
Definition at line 267 of file x86_32_common.h.
#define DR7_BP_LENGTH_4 3 /* 11 - 4 byte length */ |
Definition at line 268 of file x86_32_common.h.
#define DR7_BP_READWRITE 3 /* on data read or data write */ |
Definition at line 265 of file x86_32_common.h.
#define DR7_BP_WRITE 1 /* 01 - only on data writes */ |
Definition at line 263 of file x86_32_common.h.
Definition at line 258 of file x86_32_common.h.
#define DR7_G_ENABLE_SHIFT 1 |
Definition at line 257 of file x86_32_common.h.
#define DR7_GLOBAL_DISABLE | ( | val, | |
regnum | |||
) | (val &= ~(3 << (DR7_ENABLE_SIZE * (regnum)))) |
Definition at line 273 of file x86_32_common.h.
#define DR7_GLOBAL_ENABLE | ( | val, | |
regnum | |||
) | (val |= (1 << (DR7_G_ENABLE_SHIFT + (DR7_ENABLE_SIZE * (regnum))))) |
Definition at line 270 of file x86_32_common.h.
#define DR7_LENGTH_SHIFT 18 |
Definition at line 260 of file x86_32_common.h.
#define DR7_RESET_RWLEN_BITS | ( | val, | |
regnum | |||
) | (val &= ~(0x0f << (DR7_RW_SHIFT + DR7_RW_LEN_SIZE * (regnum)))) |
Definition at line 279 of file x86_32_common.h.
#define DR7_RW_LEN_SIZE 4 |
Definition at line 261 of file x86_32_common.h.
#define DR7_RW_SHIFT 16 |
Definition at line 259 of file x86_32_common.h.
#define DR7_SET_ACCESS | ( | val, | |
regnum | |||
) | (val |= (DR7_BP_READWRITE << (DR7_RW_SHIFT + DR7_RW_LEN_SIZE * (regnum)))) |
Definition at line 288 of file x86_32_common.h.
#define DR7_SET_EXE | ( | val, | |
regnum | |||
) | (val &= ~(0x0f << (DR7_RW_SHIFT + DR7_RW_LEN_SIZE * (regnum)))) |
Definition at line 282 of file x86_32_common.h.
#define DR7_SET_LENGTH | ( | val, | |
regnum, | |||
len | |||
) |
Definition at line 291 of file x86_32_common.h.
#define DR7_SET_WRITE | ( | val, | |
regnum | |||
) | (val |= (DR7_BP_WRITE << (DR7_RW_SHIFT + DR7_RW_LEN_SIZE * (regnum)))) |
Definition at line 285 of file x86_32_common.h.
#define DWORD 4 |
Definition at line 33 of file x86_32_common.h.
#define EFLAGS_IF ((uint32_t)0x00000200) /* Interrupt Flag */ |
Definition at line 36 of file x86_32_common.h.
#define EFLAGS_RF ((uint32_t)0x00010000) /* Resume Flag */ |
Definition at line 37 of file x86_32_common.h.
#define EFLAGS_TF ((uint32_t)0x00000100) /* Trap Flag */ |
Definition at line 35 of file x86_32_common.h.
#define EFLAGS_VM86 ((uint32_t)0x00020000) /* Virtual 8086 Mode */ |
Definition at line 38 of file x86_32_common.h.
#define MAX_DEBUG_REGS 4 |
Definition at line 248 of file x86_32_common.h.
#define MAX_SW_BPTS 20 |
Definition at line 250 of file x86_32_common.h.
#define NUM_PM_REGS 18 /* regs used in save/restore */ |
Definition at line 200 of file x86_32_common.h.
#define PM_DR6 ((uint32_t)0xFFFF0FF0) |
Definition at line 50 of file x86_32_common.h.
#define SSAR_DPL ((uint32_t)0x00006000) |
Definition at line 42 of file x86_32_common.h.
#define SW_BP_OPCODE 0xf1 |
Definition at line 249 of file x86_32_common.h.
#define WORD 2 |
Definition at line 32 of file x86_32_common.h.
#define X86_32_COMMON_MAGIC 0x86328632U |
Definition at line 151 of file x86_32_common.h.
anonymous enum |
Definition at line 57 of file x86_32_common.h.
anonymous enum |
Definition at line 153 of file x86_32_common.h.
enum x86_core_type |
Enumerator | |
---|---|
LMT1 | |
LMT3_5 |
Definition at line 187 of file x86_32_common.h.
bool check_not_halted | ( | const struct target * | t | ) |
Definition at line 206 of file lakemont.c.
References halted(), LOG_ERROR, target::state, and TARGET_HALTED.
Referenced by lakemont_get_core_reg(), lakemont_resume(), lakemont_step(), quark_d20xx_reset_deassert(), read_hw_reg_to_cache(), read_phys_mem(), write_hw_reg_from_cache(), write_phys_mem(), x86_32_common_add_breakpoint(), x86_32_common_add_watchpoint(), x86_32_common_read_io(), x86_32_common_read_memory(), x86_32_common_remove_breakpoint(), x86_32_common_remove_watchpoint(), x86_32_common_write_io(), x86_32_common_write_memory(), and x86_32_common_write_phys_mem().
|
inlinestatic |
Definition at line 241 of file x86_32_common.h.
References target::arch_info.
Referenced by calcaddr_physfromlin(), disable_paging(), drscan(), enable_paging(), get_num_user_regs(), halt_prep(), irscan(), is_paging_enabled(), lakemont_arch_state(), lakemont_build_reg_cache(), lakemont_poll(), lakemont_reset_assert(), lakemont_reset_break(), lakemont_resume(), lakemont_step(), read_all_core_hw_regs(), read_hw_reg(), read_hw_reg_to_cache(), read_mem(), read_phys_mem(), restore_context(), set_breakpoint(), set_debug_regs(), set_hwbp(), set_swbp(), set_watchpoint(), submit_pir(), unset_debug_regs(), unset_hwbp(), unset_swbp(), unset_watchpoint(), write_all_core_hw_regs(), write_hw_reg(), write_hw_reg_from_cache(), write_mem(), write_phys_mem(), x86_32_common_read_io(), x86_32_common_read_memory(), x86_32_common_read_phys_mem(), x86_32_common_reset_breakpoints_watchpoints(), x86_32_common_virt2phys(), x86_32_common_write_io(), x86_32_common_write_memory(), x86_32_common_write_phys_mem(), and x86_32_get_gdb_reg_list().
int x86_32_common_add_breakpoint | ( | struct target * | t, |
struct breakpoint * | bp | ||
) |
Definition at line 859 of file x86_32_common.c.
References breakpoint::address, check_not_halted(), ERROR_TARGET_NOT_HALTED, LOG_DEBUG, set_breakpoint(), TARGET_ADDR_FMT, and breakpoint::type.
Referenced by lakemont_step().
int x86_32_common_add_watchpoint | ( | struct target * | t, |
struct watchpoint * | wp | ||
) |
Definition at line 841 of file x86_32_common.c.
References check_not_halted(), and set_watchpoint().
int x86_32_common_init_arch_info | ( | struct target * | target, |
struct x86_32_common * | x86_32 | ||
) |
Definition at line 80 of file x86_32_common.c.
References target::arch_info, x86_32_common::common_magic, x86_32_common::curr_tap, ERROR_FAIL, ERROR_OK, x86_32_common::fast_data_area, x86_32_common::flush, x86_32_common::hw_break_list, LOG_ERROR, MAX_DEBUG_REGS, NULL, x86_32_common::num_hw_bpoints, read_hw_reg_to_cache(), x86_32_common::read_hw_reg_to_cache, target::tap, write_hw_reg_from_cache(), x86_32_common::write_hw_reg_from_cache, and X86_32_COMMON_MAGIC.
Referenced by quark_d20xx_target_create().
int x86_32_common_mmu | ( | struct target * | t, |
int * | enabled | ||
) |
Definition at line 99 of file x86_32_common.c.
References ERROR_OK.
int x86_32_common_read_io | ( | struct target * | t, |
uint32_t | addr, | ||
uint32_t | size, | ||
uint8_t * | buf | ||
) |
Definition at line 680 of file x86_32_common.c.
References addr, buf_get_u32(), BYTE, x86_32_common::cache, check_not_halted(), CSAR, CSAR_D, x86_32_common::disable_paging, DWORD, EAX, EDX, x86_32_common::enable_paging, ERROR_FAIL, ERROR_OK, IORDB16, IORDB32, IORDH16, IORDH32, IORDW16, IORDW32, x86_32_common::is_paging_enabled, LOG_DEBUG, LOG_ERROR, x86_32_common::read_hw_reg, reg_cache::reg_list, size, x86_32_common::submit_instruction, target_to_x86_32(), x86_32_common::transaction_status, reg::value, WORD, and x86_32_common::write_hw_reg.
Referenced by COMMAND_HANDLER().
int x86_32_common_read_memory | ( | struct target * | t, |
target_addr_t | addr, | ||
uint32_t | size, | ||
uint32_t | count, | ||
uint8_t * | buf | ||
) |
Definition at line 568 of file x86_32_common.c.
References addr, calcaddr_physfromlin(), check_not_halted(), count, x86_32_common::disable_paging, x86_32_common::enable_paging, ERROR_COMMAND_ARGUMENT_INVALID, ERROR_FAIL, ERROR_OK, x86_32_common::is_paging_enabled, LOG_DEBUG, LOG_ERROR, size, TARGET_ADDR_FMT, target_to_x86_32(), and x86_32_common_read_phys_mem().
int x86_32_common_read_phys_mem | ( | struct target * | t, |
target_addr_t | phys_address, | ||
uint32_t | size, | ||
uint32_t | count, | ||
uint8_t * | buffer | ||
) |
Definition at line 135 of file x86_32_common.c.
References buffer, count, ERROR_OK, swbp_mem_patch::next, offset, swbp_mem_patch::orig_byte, swbp_mem_patch::physaddr, read_phys_mem(), size, x86_32_common::swbbp_mem_patch_list, and target_to_x86_32().
Referenced by calcaddr_physfromlin(), and x86_32_common_read_memory().
int x86_32_common_remove_breakpoint | ( | struct target * | t, |
struct breakpoint * | bp | ||
) |
Definition at line 870 of file x86_32_common.c.
References breakpoint::address, check_not_halted(), ERROR_OK, ERROR_TARGET_NOT_HALTED, breakpoint::is_set, LOG_DEBUG, TARGET_ADDR_FMT, breakpoint::type, and unset_breakpoint().
Referenced by lakemont_step().
int x86_32_common_remove_watchpoint | ( | struct target * | t, |
struct watchpoint * | wp | ||
) |
Definition at line 850 of file x86_32_common.c.
References check_not_halted(), ERROR_OK, ERROR_TARGET_NOT_HALTED, watchpoint::is_set, and unset_watchpoint().
void x86_32_common_reset_breakpoints_watchpoints | ( | struct target * | t | ) |
Definition at line 1271 of file x86_32_common.c.
References x86_32_dbg_reg::bp_value, target::breakpoints, x86_32_common::hw_break_list, breakpoint::next, watchpoint::next, x86_32_common::num_hw_bpoints, breakpoint::orig_instr, target_to_x86_32(), x86_32_dbg_reg::used, and target::watchpoints.
Referenced by lakemont_reset_assert().
int x86_32_common_virt2phys | ( | struct target * | t, |
target_addr_t | address, | ||
target_addr_t * | physical | ||
) |
Definition at line 105 of file x86_32_common.c.
References buf_get_u32(), x86_32_common::cache, calcaddr_physfromlin(), CR0, CR0_PG, DSB, ERROR_FAIL, ERROR_OK, LOG_ERROR, reg_cache::reg_list, TARGET_ADDR_FMT, target_to_x86_32(), and reg::value.
int x86_32_common_write_io | ( | struct target * | t, |
uint32_t | addr, | ||
uint32_t | size, | ||
const uint8_t * | buf | ||
) |
Definition at line 760 of file x86_32_common.c.
References addr, buf_get_u32(), BYTE, x86_32_common::cache, check_not_halted(), CSAR, CSAR_D, x86_32_common::disable_paging, DWORD, EAX, EDX, x86_32_common::enable_paging, ERROR_FAIL, ERROR_OK, IOWRB16, IOWRB32, IOWRH16, IOWRH32, IOWRW16, IOWRW32, x86_32_common::is_paging_enabled, LOG_DEBUG, LOG_ERROR, reg_cache::reg_list, size, x86_32_common::submit_instruction, target_to_x86_32(), x86_32_common::transaction_status, reg::value, WORD, and x86_32_common::write_hw_reg.
Referenced by lakemont_reset_assert(), and target_fill_io().
int x86_32_common_write_memory | ( | struct target * | t, |
target_addr_t | addr, | ||
uint32_t | size, | ||
uint32_t | count, | ||
const uint8_t * | buf | ||
) |
Definition at line 625 of file x86_32_common.c.
References addr, calcaddr_physfromlin(), check_not_halted(), count, x86_32_common::disable_paging, x86_32_common::enable_paging, ERROR_COMMAND_ARGUMENT_INVALID, ERROR_FAIL, ERROR_OK, x86_32_common::is_paging_enabled, LOG_DEBUG, LOG_ERROR, size, TARGET_ADDR_FMT, target_to_x86_32(), and x86_32_common_write_phys_mem().
int x86_32_common_write_phys_mem | ( | struct target * | t, |
target_addr_t | phys_address, | ||
uint32_t | size, | ||
uint32_t | count, | ||
const uint8_t * | buffer | ||
) |
Definition at line 219 of file x86_32_common.c.
References target::breakpoints, buffer, check_not_halted(), count, ERROR_COMMAND_ARGUMENT_INVALID, ERROR_FAIL, ERROR_OK, LOG_ERROR, breakpoint::next, swbp_mem_patch::next, NULL, offset, breakpoint::orig_instr, swbp_mem_patch::physaddr, size, SW_BP_OPCODE, x86_32_common::swbbp_mem_patch_list, swbp_mem_patch::swbp_unique_id, TARGET_ADDR_FMT, target_to_x86_32(), breakpoint::unique_id, and write_phys_mem().
Referenced by x86_32_common_write_memory().
int x86_32_get_gdb_reg_list | ( | struct target * | t, |
struct reg ** | reg_list[], | ||
int * | reg_list_size, | ||
enum target_register_class | reg_class | ||
) |
Definition at line 57 of file x86_32_common.c.
References buf_get_u32(), x86_32_common::cache, ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, reg::name, reg_cache::num_regs, reg_cache::reg_list, target_to_x86_32(), and reg::value.
|
extern |
Definition at line 1451 of file x86_32_common.c.