LibGoblin_BinaryInfo *p_binfo )
{
int i_result;
- //Byte *pb_data;
- //LibGoblin_BinaryFile *p_bfile;
assert( NULL != p_binfo );
- //p_bfile = BinaryFile_GetBinaryFile( p_binfo->i_binfile );
- //pb_data = p_bfile->pb_binary;
- //assert( NULL != pb_data );
+
+ // XXX - for DEV/DEBUG
+ p_binfo->ptr_loadbase = 0x00000000800000000;
/* Read Program Header to ObjectInfo ------------------*/
i_result = ELF_ProgramHeader_Read( p_pginfo, p_binfo );
ptr_end = 0x0000000000000000;
for( i_cnt = 0; i_cnt < i_phdrnum; i_cnt++ ) {
- if( ptr_start > p_proghdr->p_vaddr )
- { ptr_start = (PtrValue)p_proghdr->p_vaddr; }
- if( ptr_end < (p_proghdr->p_vaddr + p_proghdr->p_memsz) )
- { ptr_end = (p_proghdr->p_vaddr + p_proghdr->p_memsz); }
+ if( ptr_start > ((PtrValue)p_proghdr->p_vaddr + p_binfo->ptr_loadbase) )
+ { ptr_start = (PtrValue)p_proghdr->p_vaddr + p_binfo->ptr_loadbase; }
+ if( ptr_end < ((PtrValue)p_proghdr->p_vaddr + p_binfo->ptr_loadbase + p_proghdr->p_memsz) )
+ { ptr_end = ((PtrValue)p_proghdr->p_vaddr + p_binfo->ptr_loadbase + p_proghdr->p_memsz); }
// for Next-Loop proc.
p_proghdr = (Elf64_Phdr *)(pb_data + p_elfhdr->e_phoff + ((i_cnt + 1) * i_phdrsize));
}
p_objinfo = ObjectInfo_InsetObject(
- p_pginfo, ptr_start, (ptr_end - ptr_start), NULL, 0x00 );
+ p_pginfo, ptr_start, (ptr_end - ptr_start), NULL, 0x00 );
if( NULL == p_objinfo ) {
return -0x01;
}
p_objinfo->pstr_name = p_binfo->str_filename;
p_objinfo->info.program.i_binfo_id = p_binfo->i_id;
+
// Regist ProgramHeader to ObjectInfo *****************
p_proghdr = (Elf64_Phdr *)(pb_data + p_elfhdr->e_phoff);
// p_vaddr - Virtual address in memory image.
// p_memsz - Size of contents in memory.
p_objinfo = ObjectInfo_InsetObject(
- p_pginfo, p_proghdr->p_vaddr, p_proghdr->p_memsz, NULL, 0x01 );
+ p_pginfo, ((PtrValue)p_proghdr->p_vaddr + p_binfo->ptr_loadbase),
+ p_proghdr->p_memsz, NULL, 0x01 );
if( NULL == p_objinfo ) {
return -0x02;
}
LIBGOBLIN_SECTION_EXTERN
LibGoblin_SectionInfo *Section_GetSectionInfo_fromBinaryInfo(
LibGoblin_BinaryInfo *p_binfo, Byte b_secid );
+/*
LIBGOBLIN_SECTION_EXTERN
Word LibGoblin_Section_GetSectionID_fromSectionNumber_inElf(
LibGoblin_BinaryInfo *p_binfo, Word w_secnumber );
+*/
LIBGOBLIN_SECTION_EXTERN
int Section_UpdateSectionInfo_inProgInfo(
LibGoblin_ProgramInfo *p_pginfo, LibGoblin_BinaryInfo *p_binfo );