Ejemplo n.º 1
0
        private object ReadDynamicLibraryInfo(
            SOM_Exec_aux_hdr exeAuxHdr,
            IProcessorArchitecture arch)
        {
            // According to HP's spec, the shlib info is at offset 0 of the $TEXT$ space.
            var  dlHeader   = MakeReader(exeAuxHdr.exec_tfile).ReadStruct <DlHeader>();
            uint uStrTable  = exeAuxHdr.exec_tfile + dlHeader.string_table_loc;
            var  imports    = ReadImports(exeAuxHdr.exec_tfile + dlHeader.import_list_loc, dlHeader.import_list_count, uStrTable);
            var  dltEntries = ReadDltEntries(dlHeader, exeAuxHdr.exec_dfile, imports);

            this.pltEntries = ReadPltEntries(dlHeader, exeAuxHdr, imports, arch);
            return(null);
        }
Ejemplo n.º 2
0
        private List <ImageSymbol> ReadPltEntries(DlHeader dlhdr, SOM_Exec_aux_hdr exeAuxHdr, List <string> names, IProcessorArchitecture arch)
        {
            var rdr  = MakeReader(exeAuxHdr.exec_dfile + dlhdr.plt_loc);
            var dlts = new List <ImageSymbol>();

            for (int i = 0; i < dlhdr.plt_count; ++i)
            {
                var  addr        = Address.Ptr32(exeAuxHdr.exec_dmem + ((uint)rdr.Offset - exeAuxHdr.exec_dfile));
                uint n           = rdr.ReadUInt32();
                uint m           = rdr.ReadUInt32();
                var  name        = names[i + dlhdr.dlt_count];
                var  pltEntry    = ImageSymbol.ExternalProcedure(arch, Address.Ptr32(n), name);
                var  pltGotEntry = ImageSymbol.DataObject(arch, addr, name + "@@GOT", PrimitiveType.Ptr32);
                dlts.Add(pltEntry);
                dlts.Add(pltGotEntry);
            }
            return(dlts);
        }