Merge remote-tracking branch 'origin/patch'

This commit is contained in:
ghidra1 2024-03-13 09:04:01 -04:00
commit 193e7221fd
3 changed files with 41 additions and 38 deletions

View file

@ -1093,7 +1093,7 @@ public abstract class CompositeEditorPanel extends JPanel
private Integer findBackward(String text) {
String searchText = text.toLowerCase();
int colCount = model.getColumnCount();
int colCount = table.getColumnCount();
int currentRow = Math.max(0, model.getRow());
// search previous lines
@ -1117,16 +1117,20 @@ public abstract class CompositeEditorPanel extends JPanel
return null;
}
private boolean matchesSearch(String searchText, int row, int col) {
int modelCol = table.convertColumnIndexToModel(col);
Object valueAt = model.getValueAt(row, modelCol);
private boolean matchesSearch(String searchText, int viewRow, int viewCol) {
// Note: row is the same in view and model space; col is in view space and can differ from
// the model, since columns can be hidden in the view, but remain in the model.
int modelRow = viewRow;
int modelCol = table.convertColumnIndexToModel(viewCol);
Object valueAt = model.getValueAt(modelRow, modelCol);
if (valueAt == null) {
return false;
}
String value = getString(valueAt).toLowerCase();
if (modelCol == model.getNameColumn()) {
return nameMatchesSearch(searchText, row, value);
if (viewCol == model.getNameColumn()) {
return nameMatchesSearch(searchText, modelRow, value);
}
return value.contains(searchText);

View file

@ -203,6 +203,11 @@ public class CoffMachineType {
* Hitachi SH5
*/
public final static short IMAGE_FILE_MACHINE_SH5 = 0x01a8;
/**
* Texas Instruments TMS320C3x/4x
*/
public final static short IMAGE_FILE_MACHINE_TI_TMS320C3x4x = 0x0093;
/**
* Texas Instruments TMS470

View file

@ -78,6 +78,8 @@ public class PowerPC_ElfRelocationHandler extends
// symbolValue = elfRelocationContext.getImageBaseWordAdjustmentOffset();
// }
long relocbase = elfRelocationContext.getImageBaseWordAdjustmentOffset();
int offset = (int) relocationAddress.getOffset();
int oldValue = memory.getInt(relocationAddress);
int newValue = 0;
@ -106,47 +108,39 @@ public class PowerPC_ElfRelocationHandler extends
break;
case R_PPC_ADDR16:
case R_PPC_UADDR16:
case R_PPC_ADDR16_LO:
newValue = (int) symbolValue + addend;
memory.setShort(relocationAddress, (short) newValue);
byteLength = 2;
break;
case R_PPC_ADDR16_LO:
if (Long.compareUnsigned(symbolValue, relocbase) > 0 &&
Long.compareUnsigned(symbolValue, relocbase + addend) <= 0) {
/**
* (freebsd) Addend values are sometimes relative to sections in rela,
* where in reality they are relative to relocbase. Detect this condition.
*/
symbolValue = (int) relocbase;
}
newValue = (int) (symbolValue + addend);
memory.setShort(relocationAddress, (short) newValue);
byteLength = 2;
break;
case R_PPC_ADDR16_HI:
newValue = ((int) symbolValue + addend) >> 16;
memory.setShort(relocationAddress, (short) newValue);
byteLength = 2;
break;
/**
*
R_POWERPC_ADDR16_HA: ((Symbol + Addend + 0x8000) >> 16) & 0xffff
static inline void addr16_ha(unsigned char* view, Address value)
{ This::addr16_hi(view, value + 0x8000); }
static inline void
addr16_hi(unsigned char* view, Address value)
{ This::template rela<16,16>(view, 16, 0xffff, value + 0x8000, CHECK_NONE); }
rela(unsigned char* view,
unsigned int right_shift,
typename elfcpp::Valtype_base<fieldsize>::Valtype dst_mask,
Address value,
Overflow_check overflow)
{
typedef typename elfcpp::Swap<fieldsize, big_endian>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
Valtype val = elfcpp::Swap<fieldsize, big_endian>::readval(wv); // original bytes
Valtype reloc = value >> 16;
val &= ~0xffff;
reloc &= dst_mask;
elfcpp::Swap<fieldsize, big_endian>::writeval(wv, val | reloc); // write instr btes
return overflowed<valsize>(value >> 16, overflow);
}
*/
case R_PPC_ADDR16_HA:
newValue = ((int) symbolValue + addend + 0x8000) >> 16;
if (Long.compareUnsigned(symbolValue, relocbase) > 0 &&
Long.compareUnsigned(symbolValue, relocbase + addend) <= 0) {
/**
* (freebsd) Addend values are sometimes relative to sections in rela,
* where in reality they are relative to relocbase. Detect this condition.
*/
symbolValue = (int) relocbase;
}
newValue = (int) (symbolValue + addend);
newValue = (newValue >> 16) + ((newValue & 0x8000) != 0 ? 1 : 0);
memory.setShort(relocationAddress, (short) newValue);
byteLength = 2;
break;
@ -264,4 +258,4 @@ public class PowerPC_ElfRelocationHandler extends
return new RelocationResult(Status.APPLIED, byteLength);
}
}
}