linux-mips-fnet
[Top] [All Lists]

Re: Magic number

To: linux-mips@fnet.fr
Subject: Re: Magic number
From: Ralf Baechle <ralf@Julia.DE>
Date: Tue, 4 Jun 1996 02:09:49 +0200 (MET DST)
In-reply-to: <199606030010.RAA08371@Crissy.Stanford.EDU> from "Steph Hannon" at Jun 2, 96 05:10:39 pm
Hi,

> We are using the SGI cross-compiler developed by Tor to compile our
> linux source tree.  We wrote a disassembler to look at the information
> in the header.  We have two problems which we hope someone can help us
> with:
> 
> 1) The magic number we read out is 263.  The numbers that seem to be
> valid are 407, 410, 413, 314 for OMAGIC, NMAGIC, ZMAGIC and QMAGIC,
> respectively.  We can't use standard tools like dis and gdb on this
> binary so we were wondering what is wrong with our magic number.

263 decimal == 407 octal :-)

> 2) We read the header into a struct called kexec, just like the a.out
> loader.  In our struct, kexec.a_entry is 0x0.  If we read the value
> associated with "kernel_entry" out of the symbol table it is 0x01a4.
> Should these be the same or does milo use this field?

For all normal a.out executables a_entry is the virtual loadaddress
AND the entry point into the kernel.  The Linux/MIPS a.out format
bootfiles have their execption handlers at the start of the code, so
this wouldn't work.  That's why the value of the kernel_entry symbol
is used instead.

> We should note, to get the binary to compile to big-endian format with
> the SGI complier we had to make two changes:
> 
> - in /usr/local/mips-linux/ldscripts we had to change the 
> mipslinux.x* files so the output format was "a.out-mips-big-linux"
> - we changed the make file so that ld used the option
>       -oformat a.out-mips-big-linux
>   because ld was still generating little endian after we made the first
>   change

Ok, this is a bug.  There should be linker scripts for mipslinux.x*
and mipsellinux.x*.  Always thought noone'd notice :-)

  Ralf

<Prev in Thread] Current Thread [Next in Thread>
  • Magic number, Steph Hannon
    • Re: Magic number, Ralf Baechle <=