Java Code Examples for ghidra.program.model.lang.Language#getDefaultSpace()
The following examples show how to use
ghidra.program.model.lang.Language#getDefaultSpace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PIC30_ElfExtension.java From ghidra with Apache License 2.0 | 5 votes |
@Override public AddressSpace getPreferredSegmentAddressSpace(ElfLoadHelper elfLoadHelper, ElfProgramHeader elfProgramHeader) { Language language = elfLoadHelper.getProgram().getLanguage(); if (isDataLoad(elfProgramHeader)) { return language.getDefaultDataSpace(); } return language.getDefaultSpace(); }
Example 2
Source File: PIC30_ElfExtension.java From ghidra with Apache License 2.0 | 5 votes |
@Override public AddressSpace getPreferredSectionAddressSpace(ElfLoadHelper elfLoadHelper, ElfSectionHeader elfSectionHeader) { Language language = elfLoadHelper.getProgram().getLanguage(); if (isDataLoad(elfSectionHeader)) { return language.getDefaultDataSpace(); } return language.getDefaultSpace(); }
Example 3
Source File: DWARFAnalyzer.java From ghidra with Apache License 2.0 | 5 votes |
@Override public boolean getDefaultEnablement(Program program) { // TODO: DWARF implementation needs improvements to handle Harvard Architectures properly // Currently unable to produce addresses which should refer to data space resulting in // improperly placed symbols, etc. Language language = program.getLanguage(); return language.getDefaultSpace() == language.getDefaultDataSpace(); }
Example 4
Source File: CoffSectionHeader.java From ghidra with Apache License 2.0 | 5 votes |
private static int getOffsetUnitSize(Language language, CoffSectionHeader section) { // Assumes all offset utilize a consistent unit size based upon the code space. // Keep notes here when this offset characterization is violated and a new one established. // TMS320C55x appears to use byte offsets (unit sizes: code=1 data=2) AddressSpace codeSpace = language.getDefaultSpace(); // presumed code space if (section == null || !section.isExplicitlyByteAligned()) { return codeSpace.getAddressableUnitSize(); } return 1; }
Example 5
Source File: OmfSegmentHeader.java From ghidra with Apache License 2.0 | 5 votes |
/** * @param language is the Program language for this binary * @return the starting Address for this segment */ public Address getAddress(Language language) { AddressSpace addrSpace; if (isCode) { addrSpace = language.getDefaultSpace(); } else { addrSpace = language.getDefaultDataSpace(); } return addrSpace.getAddress(vma); }
Example 6
Source File: OmfGroupRecord.java From ghidra with Apache License 2.0 | 4 votes |
public Address getAddress(Language language) { AddressSpace addrSpace = language.getDefaultSpace(); return addrSpace.getAddress(vma); }
Example 7
Source File: CoffSectionHeader.java From ghidra with Apache License 2.0 | 2 votes |
/** * Convert address offset to an Address object. The default data space (defined by pspec) * will be used if section is null or corresponds to a data section. The language default * space (defined by slaspec) will be used for all non-data sections. If pspec does not * specify a default data space, the default language space is used. * @param language * @param offset address offset (byte offset assumed if section is null or is not explicitly * byte aligned, otherwise word offset assumed). * @param section section which contains the specified offset or null (data space assumed) * @return address object */ public static Address getAddress(Language language, long offset, CoffSectionHeader section) { boolean isData = section == null || section.isData(); AddressSpace space = isData ? language.getDefaultDataSpace() : language.getDefaultSpace(); return space.getAddress(offset * getOffsetUnitSize(language, section)); }