mips32, add support for micromips in debug mode
Micromips is 16bit oriented, branch and jumps are 16 bit based. The upper half 16bits of a 32bit instruction with the major opcode, must go first in the instruction stream, hence the SWAP16 macro and swap16 array function, needed if the code is written as 32 bit word in little endian cores. Endianess info added to ejtag_iinfo. Pointer to ejtag_info and isa field added to pracc context. MIPS32 code are renamed to MIPS32_ISA_... To select the isa, the new code has an additional isa parameter (1 for micromips, 0 for mips32). In JR instruction the isa bit must be set to execute micromips code. The suffix u is added to the OP codes to avoid signed/unsigned comparison errors and to make sure the right shift is performed logically. The isa in debug mode is updated in the poll function. Code for miniprograms, in kernel mode, need to be converted. CFI code only for mips32. Change-Id: I79a8b637d49b0e2d92b6dd5eb5aa8aa0520bf938 Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es> Reviewed-on: http://openocd.zylin.com/4032 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
This commit is contained in:
committed by
Freddie Chopin
parent
6012a87d44
commit
2279c23cde
@@ -195,6 +195,8 @@ static int mips_m4k_poll(struct target *target)
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
ejtag_info->isa = (ejtag_ctrl & EJTAG_CTRL_DBGISA) ? 1 : 0;
|
||||
|
||||
/* clear this bit before handling polling
|
||||
* as after reset registers will read zero */
|
||||
if (ejtag_ctrl & EJTAG_CTRL_ROCC) {
|
||||
@@ -648,14 +650,14 @@ static int mips_m4k_set_breakpoint(struct target *target,
|
||||
breakpoint->orig_instr);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
retval = target_write_u32(target, breakpoint->address, MIPS32_SDBBP);
|
||||
retval = target_write_u32(target, breakpoint->address, MIPS32_SDBBP(ejtag_info->isa));
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
retval = target_read_u32(target, breakpoint->address, &verify);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
if (verify != MIPS32_SDBBP) {
|
||||
if (verify != MIPS32_SDBBP(ejtag_info->isa)) {
|
||||
LOG_ERROR("Unable to set 32-bit breakpoint at address " TARGET_ADDR_FMT
|
||||
" - check that memory is read/writable", breakpoint->address);
|
||||
return ERROR_OK;
|
||||
@@ -667,14 +669,14 @@ static int mips_m4k_set_breakpoint(struct target *target,
|
||||
breakpoint->orig_instr);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
retval = target_write_u16(target, breakpoint->address, MIPS16_SDBBP);
|
||||
retval = target_write_u16(target, breakpoint->address, MIPS16_SDBBP(ejtag_info->isa));
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
retval = target_read_u16(target, breakpoint->address, &verify);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
if (verify != MIPS16_SDBBP) {
|
||||
if (verify != MIPS16_SDBBP(ejtag_info->isa)) {
|
||||
LOG_ERROR("Unable to set 16-bit breakpoint at address " TARGET_ADDR_FMT
|
||||
" - check that memory is read/writable", breakpoint->address);
|
||||
return ERROR_OK;
|
||||
@@ -735,7 +737,7 @@ static int mips_m4k_unset_breakpoint(struct target *target,
|
||||
*/
|
||||
current_instr = target_buffer_get_u32(target, (uint8_t *)¤t_instr);
|
||||
|
||||
if (current_instr == MIPS32_SDBBP) {
|
||||
if (current_instr == MIPS32_SDBBP(ejtag_info->isa)) {
|
||||
retval = target_write_memory(target, breakpoint->address, 4, 1,
|
||||
breakpoint->orig_instr);
|
||||
if (retval != ERROR_OK)
|
||||
@@ -750,7 +752,7 @@ static int mips_m4k_unset_breakpoint(struct target *target,
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
current_instr = target_buffer_get_u16(target, (uint8_t *)¤t_instr);
|
||||
if (current_instr == MIPS16_SDBBP) {
|
||||
if (current_instr == MIPS16_SDBBP(ejtag_info->isa)) {
|
||||
retval = target_write_memory(target, breakpoint->address, 2, 1,
|
||||
breakpoint->orig_instr);
|
||||
if (retval != ERROR_OK)
|
||||
|
||||
Reference in New Issue
Block a user