/[hurd]/hurd-l4/laden/loader.c
ViewVC logotype

Diff of /hurd-l4/laden/loader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by marcus, Fri Sep 19 18:50:12 2003 UTC revision 1.10 by marcus, Thu Sep 25 12:39:20 2003 UTC
# Line 18  Line 18 
18     along with this program; if not, write to the Free Software     along with this program; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. */     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. */
20    
21    #if HAVE_CONFIG_H
22    #include <config.h>
23    #endif
24    
25  #include <string.h>  #include <string.h>
26    
27  #include "loader.h"  #include "loader.h"
# Line 183  loader_elf_load (const char *name, l4_wo Line 187  loader_elf_load (const char *name, l4_wo
187    if (!elf->e_phoff)    if (!elf->e_phoff)
188      panic ("%s has no valid program header offset", name);      panic ("%s has no valid program header offset", name);
189    
190  #ifdef i386    /* FIXME: Some architectures support both word sizes.  */
191    if (elf->e_ident[EI_CLASS] != ELFCLASS32    if (!((elf->e_ident[EI_CLASS] == ELFCLASS32
192        || elf->e_ident[EI_DATA] != ELFDATA2LSB           && L4_WORD_SIZE == 32)
193        || elf->e_machine != EM_386)          || (elf->e_ident[EI_CLASS] == ELFCLASS64
194      panic ("%s is not for this architecture", name);              && L4_WORD_SIZE == 64)))
195        panic ("%s has invalid word size", name);
196      if (!((elf->e_ident[EI_DATA] == ELFDATA2LSB
197             && L4_BYTE_ORDER == L4_LITTLE_ENDIAN)
198            || (elf->e_ident[EI_DATA] == ELFDATA2MSB
199                && L4_BYTE_ORDER == L4_BIG_ENDIAN)))
200        panic ("%s has invalid byte order", name);
201    
202    #if i386
203    # define elf_machine EM_386
204    #elif PPC
205    # define elf_machine EM_PPC
206  #else  #else
207  #error Not ported to this architecture!  # error Not ported to this architecture!
208  #endif  #endif
209    
210      if (elf->e_machine != elf_machine)
211        panic ("%s is not for this architecture", name);
212    
213    for (i = 0; i < elf->e_phnum; i++)    for (i = 0; i < elf->e_phnum; i++)
214      {      {
215        Elf32_Phdr *ph = (Elf32_Phdr *) (start + elf->e_phoff        Elf32_Phdr *ph = (Elf32_Phdr *) (start + elf->e_phoff

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26