patch-2.4.19 linux-2.4.19/include/asm-mips64/elf.h

Next file: linux-2.4.19/include/asm-mips64/errno.h
Previous file: linux-2.4.19/include/asm-mips64/div64.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/include/asm-mips64/elf.h linux-2.4.19/include/asm-mips64/elf.h
@@ -14,6 +14,17 @@
 #define ELF_NGREG	45
 #define ELF_NFPREG	33
 
+/* ELF header e_flags defines. MIPS architecture level. */
+#define EF_MIPS_ARCH_1      0x00000000  /* -mips1 code.  */
+#define EF_MIPS_ARCH_2      0x10000000  /* -mips2 code.  */
+#define EF_MIPS_ARCH_3      0x20000000  /* -mips3 code.  */
+#define EF_MIPS_ARCH_4      0x30000000  /* -mips4 code.  */
+#define EF_MIPS_ARCH_5      0x40000000  /* -mips5 code.  */
+#define EF_MIPS_ARCH_32     0x60000000  /* MIPS32 code.  */
+#define EF_MIPS_ARCH_64     0x70000000  /* MIPS64 code.  */
+#define EF_MIPS_ARCH_32R2   0x80000000  /* MIPS32 code.  */
+#define EF_MIPS_ARCH_64R2   0x90000000  /* MIPS64 code.  */
+
 typedef unsigned long elf_greg_t;
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 
@@ -21,8 +32,7 @@
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
 /*
- * This is used to ensure we don't load something for the wrong 
- * architecture or OS.
+ * This is used to ensure we don't load something for the wrong architecture.
  */
 #define elf_check_arch(hdr)						\
 ({									\
@@ -34,6 +44,11 @@
 	if (sizeof(elf_caddr_t) == 8 &&					\
 	    __h->e_ident[EI_CLASS] == ELFCLASS32)			\
 	        __res = 0;						\
+	if (((__h->e_flags & EF_MIPS_ARCH) != EF_MIPS_ARCH_1) &&	\
+	    ((__h->e_flags & EF_MIPS_ARCH) != EF_MIPS_ARCH_2) &&	\
+	    ((__h->e_flags & EF_MIPS_ARCH) != EF_MIPS_ARCH_32) &&	\
+	    ((__h->e_flags & EF_MIPS_ARCH) != EF_MIPS_ARCH_32R2))	\
+                __res = 0;						\
 									\
 	__res;								\
 })

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)