OSDN Git Service

2019/01/30(Wed) 21:54
authorKoine Yuusuke(koinec) <koinec@users.osdn.me>
Wed, 30 Jan 2019 12:54:41 +0000 (21:54 +0900)
committerKoine Yuusuke(koinec) <koinec@users.osdn.me>
Wed, 30 Jan 2019 12:54:41 +0000 (21:54 +0900)
 (LibGoblin)
  * WorkBackup

libgoblin/drd64_libgoblin_elf_proghdr.c
libgoblin/drd64_libgoblin_section.c
libgoblin/drd64_libgoblin_type.h

index 9c1152d..b38d5f7 100644 (file)
@@ -69,6 +69,8 @@ int
        
        for( i_cnt = 0; i_cnt < i_phdrnum; i_cnt++ )    {
                // Inset ObjectInfo ---
+               //   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, 0x00 );
                if( NULL == p_objinfo ) {
@@ -77,11 +79,21 @@ int
 
                // Set ProgramHdr Value to ObjectInfo  ---
                p_objinfo->b_type                       = OBJINFO_TYPE_PROGHDR;
+
                p_objinfo->file.i_fid           = p_binfo->i_binfile;
+               //   p_offset - File offset of contents.
                p_objinfo->file.pv_offset       = (void *)(pb_data + p_proghdr->p_offset);
+               //   p_filesz - Size of contents in file.
                p_objinfo->file.qw_size         = p_proghdr->p_filesz;
 
+               //   p_type - Entry type.
+               p_objinfo->info.proghdr.dw_type         = p_proghdr->p_type;
+               //   p_flags - Access permission flags.
+               p_objinfo->info.proghdr.dw_flags        = p_proghdr->p_flags;
+               //   p_align - Alignment in memory and file.
                p_objinfo->info.proghdr.qw_align        = p_proghdr->p_align;
+               //   ELF Program Header
+               p_objinfo->info.proghdr.pv_proghdr      = (void *)p_proghdr;
 
                // for Next-Loop proc.
                p_proghdr               = (Elf64_Phdr *)(pb_data + p_elfhdr->e_phoff + (i_cnt * i_phdrsize));
index 9faed72..8921b84 100644 (file)
@@ -293,9 +293,11 @@ int
                        p_objinfo       = ObjectInfo_InsetObject(
                                                                p_pginfo, p_section->ptr_addr.value, p_section->qw_size, NULL, 0x01 );
 
-                       p_objinfo->b_type       = OBJINFO_TYPE_SECTION;
-                       p_objinfo->file.i_fid   = p_section->i_fid;
+                       p_objinfo->b_type                       = OBJINFO_TYPE_SECTION;
+
+                       p_objinfo->file.i_fid           = p_section->i_fid;
                        p_objinfo->file.pv_offset       = (void *)p_section->pb_data;
+                       p_objinfo->file.qw_size         = p_section->qw_size;
                        
 
                }
@@ -309,6 +311,16 @@ int
                }
 */
        }
+                       // sh_name - Section name (index into the section header string table).
+                       // sh_type - Section type.
+                       // sh_flags - Section flags.
+                       // sh_addr - Address in memory image.
+                       // sh_offset - Offset in file.
+                       // sh_size - Size in bytes.
+                       // sh_link - Index of a related section.
+                       // sh_info - Depends on section type.
+                       // sh_addralign - Alignment in bytes.
+                       // sh_entsize - Size of each entry in section.
 
 
        return 0x00;
index fa01190..b8cbc9d 100644 (file)
@@ -104,11 +104,19 @@ typedef   struct  {
        // ObjectInfo (DATA) ---
        char    *pstr_name;             // Object Name (Param./Func./etc...)
        union   {
+               Byte            b_data[128];
+
                struct  {
-                       QWord   qw_align;
-                       
+                       DWord   dw_type;                /* Entry type. */
+                       DWord   dw_flags;               /* Access permission flags. */
+                       QWord   qw_align;               /* Alignment in memory and file. */
+                       void    *pv_proghdr;
                } proghdr;
 
+               struct  {
+                       void    *pv_sechdr;
+               } section;
+
        } info;