Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2010 13:38:26 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209945 - head/sys/powerpc/include
Message-ID:  <201007121338.o6CDcQZE011529@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Mon Jul 12 13:38:26 2010
New Revision: 209945
URL: http://svn.freebsd.org/changeset/base/209945

Log:
  MFppc64:
  
  Provide ELF definitions for 64-bit PowerPC. This unbreaks the powerpc
  loader build.

Modified:
  head/sys/powerpc/include/elf.h

Modified: head/sys/powerpc/include/elf.h
==============================================================================
--- head/sys/powerpc/include/elf.h	Mon Jul 12 12:16:11 2010	(r209944)
+++ head/sys/powerpc/include/elf.h	Mon Jul 12 13:38:26 2010	(r209945)
@@ -36,14 +36,26 @@
  * [ppc-eabi-1995-01.pdf] for details.
  */
 
-#include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */
-
+#ifndef __ELF_WORD_SIZE
+#ifdef __powerpc64__
+#define	__ELF_WORD_SIZE	64	/* Used by <sys/elf_generic.h> */
+#else
 #define	__ELF_WORD_SIZE	32	/* Used by <sys/elf_generic.h> */
+#endif
+#endif
+
+#include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */
+#include <sys/elf64.h>	/* Definitions common to all 64 bit architectures. */
 #include <sys/elf_generic.h>
 
+#if __ELF_WORD_SIZE == 64
+#define	ELF_ARCH	EM_PPC64
+#define	ELF_MACHINE_OK(x) ((x) == EM_PPC64)
+#else
 #define	ELF_ARCH	EM_PPC
-
+#define	ELF_ARCH32	EM_PPC
 #define	ELF_MACHINE_OK(x) ((x) == EM_PPC)
+#endif
 
 /*
  * Auxiliary vector entries for passing information to the interpreter.
@@ -61,6 +73,15 @@ typedef struct {	/* Auxiliary vector ent
 	} a_un;
 } Elf32_Auxinfo;
 
+typedef struct {	/* Auxiliary vector entry on initial stack */
+	long	a_type;			/* Entry type. */
+	union {
+		long	a_val;		/* Integer value. */
+		void	*a_ptr;		/* Address. */
+		void	(*a_fcn)(void);	/* Function pointer (not used). */
+	} a_un;
+} Elf64_Auxinfo;
+
 __ElfType(Auxinfo);
 
 /* Values for a_type. */
@@ -91,10 +112,17 @@ __ElfType(Auxinfo);
 #define	R_PPC_EMB_COUNT		(R_PPC_EMB_RELSDA - R_PPC_EMB_NADDR32 + 1)
 
 /* Define "machine" characteristics */
+#if __ELF_WORD_SIZE == 64
+#define	ELF_TARG_CLASS	ELFCLASS64
+#define	ELF_TARG_DATA	ELFDATA2MSB
+#define	ELF_TARG_MACH	EM_PPC64
+#define	ELF_TARG_VER	1
+#else
 #define	ELF_TARG_CLASS	ELFCLASS32
 #define	ELF_TARG_DATA	ELFDATA2MSB
 #define	ELF_TARG_MACH	EM_PPC
 #define	ELF_TARG_VER	1
+#endif
 
 #define	ET_DYN_LOAD_ADDR 0x01010000
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007121338.o6CDcQZE011529>