Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys * Add more OS ABI constants and dynamic array tags f...



details:   https://anonhg.NetBSD.org/src/rev/b2c89a12e80a
branches:  trunk
changeset: 482820:b2c89a12e80a
user:      kleink <kleink%NetBSD.org@localhost>
date:      Tue Feb 22 13:57:23 2000 +0000

description:
* Add more OS ABI constants and dynamic array tags from D1998-04-29.
* Enhance readibility: define data structures first, followed member value
  constants, and add more comments.

diffstat:

 sys/sys/exec_elf.h |  330 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 188 insertions(+), 142 deletions(-)

diffs (truncated from 479 to 300 lines):

diff -r 4a06f95d974b -r b2c89a12e80a sys/sys/exec_elf.h
--- a/sys/sys/exec_elf.h        Tue Feb 22 13:06:48 2000 +0000
+++ b/sys/sys/exec_elf.h        Tue Feb 22 13:57:23 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_elf.h,v 1.35 2000/02/22 10:49:19 kleink Exp $     */
+/*     $NetBSD: exec_elf.h,v 1.36 2000/02/22 13:57:23 kleink Exp $     */
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -69,16 +69,100 @@
 typedef        u_int16_t Elf64_Quarter;
 #define        ELF64_FSZ_QUARTER 2
 
-
+/*
+ * ELF Header
+ */
 #define        ELF_NIDENT      16
 
-#define        ET_NONE         0
-#define        ET_REL          1
-#define        ET_EXEC         2
-#define        ET_DYN          3
-#define        ET_CORE         4
+typedef struct {
+       unsigned char   e_ident[ELF_NIDENT];    /* Id bytes */
+       Elf32_Half      e_type;                 /* file type */
+       Elf32_Half      e_machine;              /* machine type */
+       Elf32_Word      e_version;              /* version number */
+       Elf32_Addr      e_entry;                /* entry point */
+       Elf32_Off       e_phoff;                /* Program hdr offset */
+       Elf32_Off       e_shoff;                /* Section hdr offset */
+       Elf32_Word      e_flags;                /* Processor flags */
+       Elf32_Half      e_ehsize;               /* sizeof ehdr */
+       Elf32_Half      e_phentsize;            /* Program header entry size */
+       Elf32_Half      e_phnum;                /* Number of program headers */
+       Elf32_Half      e_shentsize;            /* Section header entry size */
+       Elf32_Half      e_shnum;                /* Number of section headers */
+       Elf32_Half      e_shstrndx;             /* String table index */
+} Elf32_Ehdr;
+
+typedef struct {
+       unsigned char   e_ident[ELF_NIDENT];    /* Id bytes */
+       Elf64_Quarter   e_type;                 /* file type */
+       Elf64_Quarter   e_machine;              /* machine type */
+       Elf64_Half      e_version;              /* version number */
+       Elf64_Addr      e_entry;                /* entry point */
+       Elf64_Off       e_phoff;                /* Program hdr offset */
+       Elf64_Off       e_shoff;                /* Section hdr offset */
+       Elf64_Half      e_flags;                /* Processor flags */
+       Elf64_Quarter   e_ehsize;               /* sizeof ehdr */
+       Elf64_Quarter   e_phentsize;            /* Program header entry size */
+       Elf64_Quarter   e_phnum;                /* Number of program headers */
+       Elf64_Quarter   e_shentsize;            /* Section header entry size */
+       Elf64_Quarter   e_shnum;                /* Number of section headers */
+       Elf64_Quarter   e_shstrndx;             /* String table index */
+} Elf64_Ehdr;
+
+/* e_ident offsets */
+#define        EI_MAG0         0       /* '\177' */
+#define        EI_MAG1         1       /* 'E'    */
+#define        EI_MAG2         2       /* 'L'    */
+#define        EI_MAG3         3       /* 'F'    */
+#define        EI_CLASS        4       /* File class */
+#define        EI_DATA         5       /* Data encoding */
+#define        EI_VERSION      6       /* File version */
+#define        EI_OSABI        7       /* Operating system/ABI identification */
+#define        EI_ABIVERSION   8       /* ABI version */
+#define        EI_PAD          9       /* Start of padding bytes up to EI_NIDENT*/
+
+/* e_ident[ELFMAG0,ELFMAG3] */
+#define        ELFMAG0         0x7f
+#define        ELFMAG1         'E'
+#define        ELFMAG2         'L'
+#define        ELFMAG3         'F'
+#define        ELFMAG          "\177ELF"
+#define        SELFMAG         4
+
+/* e_ident[EI_CLASS] */
+#define        ELFCLASSNONE    0       /* Invalid class */
+#define        ELFCLASS32      1       /* 32-bit objects */
+#define        ELFCLASS64      2       /* 64-bit objects */
+#define        ELFCLASSNUM     3
+
+/* e_ident[EI_DATA] */
+#define        ELFDATANONE     0       /* Invalid data encoding */
+#define        ELFDATA2LSB     1       /* 2's complement values, LSB first */
+#define        ELFDATA2MSB     2       /* 2's complement values, MSB first */
+
+/* e_ident[EI_VERSION] */
+#define        EV_NONE         0       /* Invalid version */
+#define        EV_CURRENT      1       /* Current version */
+#define        EV_NUM          2
+
+/* e_ident[EI_OSABI] */
+#define        ELFOSABI_SYSV           0       /* UNIX System V ABI */
+#define        ELFOSABI_HPUX           1       /* HP-UX operating system */
+#define        ELFOSABI_STANDALONE     255     /* Standalone (embedded) application */
+
+/* e_type */
+#define        ET_NONE         0       /* No file type */
+#define        ET_REL          1       /* Relocatable file */
+#define        ET_EXEC         2       /* Executable file */
+#define        ET_DYN          3       /* Shared object file */
+#define        ET_CORE         4       /* Core file */
 #define        ET_NUM          5
 
+#define        ET_LOOS         0xfe00  /* Operating system specific range */
+#define        ET_HIOS         0xfeff
+#define        ET_LOPROC       0xff00  /* Processor-specific range */
+#define        ET_HIPROC       0xffff
+
+/* e_machine */
 #define        EM_NONE         0       /* No machine */
 #define        EM_M32          1       /* AT&T WE 32100 */
 #define        EM_SPARC        2       /* SPARC */
@@ -119,95 +203,9 @@
 #define        EM_ALPHA_EXP    36902   /* used by NetBSD/alpha; obsolete */
 #define        EM_NUM          36903
 
-#define        ELFCLASSNONE    0       /* Invalid class */
-#define        ELFCLASS32      1       /* 32-bit objects */
-#define        ELFCLASS64      2       /* 64-bit objects */
-#define        ELFCLASSNUM     3
-
-#define        EI_MAG0         0
-#define        EI_MAG1         1
-#define        EI_MAG2         2
-#define        EI_MAG3         3
-#define        EI_CLASS        4
-#define        EI_DATA         5
-#define        EI_VERSION      6
-#define        EI_OSABI        7
-#define        EI_ABIVERSION   8
-#define        EI_PAD          9
-
-#define        ELFDATANONE     0       /* Invalid data encoding */
-#define        ELFDATA2LSB     1       /* 2's complement values, LSB first */
-#define        ELFDATA2MSB     2       /* 2's complement values, MSB first */
-
-#define        EV_NONE         0       /* Invalid version */
-#define        EV_CURRENT      1       /* Current version */
-#define        EV_NUM          2
-
-#define        ELFOSABI_SYSV           0       /* UNIX System V ABI */
-#define        ELFOSABI_HPUX           1       /* HP-UX operating system */
-#define        ELFOSABI_STANDALONE     255     /* Standalone (embedded) application */
-
-#define        PF_R            0x4     /* Segment is readable */
-#define        PF_W            0x2     /* Segment is writable */
-#define        PF_X            0x1     /* Segment is executable */
-
-#define        PF_MASKPROC     0xf0000000      /* Processor-specific values */
-
-typedef struct {
-       unsigned char   e_ident[ELF_NIDENT];    /* Id bytes */
-       Elf32_Half      e_type;                 /* file type */
-       Elf32_Half      e_machine;              /* machine type */
-       Elf32_Word      e_version;              /* version number */
-       Elf32_Addr      e_entry;                /* entry point */
-       Elf32_Off       e_phoff;                /* Program hdr offset */
-       Elf32_Off       e_shoff;                /* Section hdr offset */
-       Elf32_Word      e_flags;                /* Processor flags */
-       Elf32_Half      e_ehsize;               /* sizeof ehdr */
-       Elf32_Half      e_phentsize;            /* Program header entry size */
-       Elf32_Half      e_phnum;                /* Number of program headers */
-       Elf32_Half      e_shentsize;            /* Section header entry size */
-       Elf32_Half      e_shnum;                /* Number of section headers */
-       Elf32_Half      e_shstrndx;             /* String table index */
-} Elf32_Ehdr;
-
-typedef struct {
-       unsigned char   e_ident[ELF_NIDENT];    /* Id bytes */
-       Elf64_Quarter   e_type;                 /* file type */
-       Elf64_Quarter   e_machine;              /* machine type */
-       Elf64_Half      e_version;              /* version number */
-       Elf64_Addr      e_entry;                /* entry point */
-       Elf64_Off       e_phoff;                /* Program hdr offset */
-       Elf64_Off       e_shoff;                /* Section hdr offset */
-       Elf64_Half      e_flags;                /* Processor flags */
-       Elf64_Quarter   e_ehsize;               /* sizeof ehdr */
-       Elf64_Quarter   e_phentsize;            /* Program header entry size */
-       Elf64_Quarter   e_phnum;                /* Number of program headers */
-       Elf64_Quarter   e_shentsize;            /* Section header entry size */
-       Elf64_Quarter   e_shnum;                /* Number of section headers */
-       Elf64_Quarter   e_shstrndx;             /* String table index */
-} Elf64_Ehdr;
-
-#define        ELFMAG0         0x7f
-#define        ELFMAG1         'E'
-#define        ELFMAG2         'L'
-#define        ELFMAG3         'F'
-#define        ELFMAG          "\177ELF"
-#define        SELFMAG         4
-
-#define        PT_NULL         0               /* Program header table entry unused */
-#define        PT_LOAD         1               /* Loadable program segment */
-#define        PT_DYNAMIC      2               /* Dynamic linking information */
-#define        PT_INTERP       3               /* Program interpreter */
-#define        PT_NOTE         4               /* Auxiliary information */
-#define        PT_SHLIB        5               /* Reserved, unspecified semantics */
-#define        PT_PHDR         6               /* Entry for header table itself */
-#define        PT_NUM          7
-
-#define        PT_LOPROC       0x70000000      /* Processor-specific range */
-#define        PT_HIPROC       0x7fffffff
-
-#define        PT_MIPS_REGINFO 0x70000000
-
+/*
+ * Program Header
+ */
 typedef struct {
        Elf32_Word      p_type;         /* entry type */
        Elf32_Off       p_offset;       /* offset */
@@ -230,9 +228,59 @@
        Elf64_Word      p_align;        /* memory & file alignment */
 } Elf64_Phdr;
 
+/* p_type */
+#define        PT_NULL         0               /* Program header table entry unused */
+#define        PT_LOAD         1               /* Loadable program segment */
+#define        PT_DYNAMIC      2               /* Dynamic linking information */
+#define        PT_INTERP       3               /* Program interpreter */
+#define        PT_NOTE         4               /* Auxiliary information */
+#define        PT_SHLIB        5               /* Reserved, unspecified semantics */
+#define        PT_PHDR         6               /* Entry for header table itself */
+#define        PT_NUM          7
+
+/* p_flags */
+#define        PF_R            0x4     /* Segment is readable */
+#define        PF_W            0x2     /* Segment is writable */
+#define        PF_X            0x1     /* Segment is executable */
+
+#define        PF_MASKOS       0x0ff00000      /* Opersting system specific values */
+#define        PF_MASKPROC     0xf0000000      /* Processor-specific values */
+
+#define        PT_LOPROC       0x70000000      /* Processor-specific range */
+#define        PT_HIPROC       0x7fffffff
+
+#define        PT_MIPS_REGINFO 0x70000000
+
 /*
  * Section Headers
  */
+typedef struct {
+       Elf32_Word      sh_name;        /* section name (.shstrtab index) */
+       Elf32_Word      sh_type;        /* section type */
+       Elf32_Word      sh_flags;       /* section flags */
+       Elf32_Addr      sh_addr;        /* virtual address */
+       Elf32_Off       sh_offset;      /* file offset */
+       Elf32_Word      sh_size;        /* section size */
+       Elf32_Word      sh_link;        /* link to another */
+       Elf32_Word      sh_info;        /* misc info */
+       Elf32_Word      sh_addralign;   /* memory alignment */
+       Elf32_Word      sh_entsize;     /* table entry size */
+} Elf32_Shdr;
+
+typedef struct {
+       Elf64_Half      sh_name;        /* section name (.shstrtab index) */
+       Elf64_Half      sh_type;        /* section type */
+       Elf64_Word      sh_flags;       /* section flags */
+       Elf64_Addr      sh_addr;        /* virtual address */
+       Elf64_Off       sh_offset;      /* file offset */
+       Elf64_Word      sh_size;        /* section size */
+       Elf64_Half      sh_link;        /* link to another */
+       Elf64_Half      sh_info;        /* misc info */
+       Elf64_Word      sh_addralign;   /* memory alignment */
+       Elf64_Word      sh_entsize;     /* table entry size */
+} Elf64_Shdr;
+
+/* sh_type */
 #define        SHT_NULL        0
 #define        SHT_PROGBITS    1
 #define        SHT_SYMTAB      2
@@ -247,51 +295,26 @@
 #define        SHT_DYNSYM      11
 #define        SHT_NUM         12
 
-#define        SHT_LOUSER      0x80000000
-#define        SHT_HIUSER      0xffffffff
+#define        SHT_LOOS        0x60000000      /* Operating system specific range */
+#define        SHT_HIOS        0x6fffffff
 #define        SHT_LOPROC      0x70000000      /* Processor-specific range */
 #define        SHT_HIPROC      0x7fffffff
-
-typedef struct {
-       Elf32_Word      sh_name;        /* section name */
-       Elf32_Word      sh_type;        /* section type */
-       Elf32_Word      sh_flags;       /* section flags */
-       Elf32_Addr      sh_addr;        /* virtual address */
-       Elf32_Off       sh_offset;      /* file offset */
-       Elf32_Word      sh_size;        /* section size */
-       Elf32_Word      sh_link;        /* link to another */
-       Elf32_Word      sh_info;        /* misc info */
-       Elf32_Word      sh_addralign;   /* memory alignment */
-       Elf32_Word      sh_entsize;     /* table entry size */
-} Elf32_Shdr;
+#define        SHT_LOUSER      0x80000000      /* Application-specific range */
+#define        SHT_HIUSER      0xffffffff



Home | Main Index | Thread Index | Old Index