PERFORCE change 159726 for review

Arnar Mar Sig antab at FreeBSD.org
Mon Mar 23 19:57:24 PDT 2009


http://perforce.freebsd.org/chv.cgi?CH=159726

Change 159726 by antab at antab_farm on 2009/03/24 02:56:24

	endian.h was wrong, avr32 is big endian but __AVR32EB__ was never defined and not needed anway.
	We can now use libkern 64bit math ops when endian is right.
	We can also use intree toolchain now so remove all hacks for external.
	Rearrange code in switch.S, must lookup pd before restoring context. (caused strange panic when using if_ate)
	Change gcc config to match i386 more. World builds but fails with unrefrenced symbols later on.

Affected files ...

.. //depot/projects/avr32/src/contrib/gcc/config/avr32/freebsd.h#4 edit
.. //depot/projects/avr32/src/lib/csu/avr32/crt1.c#2 edit
.. //depot/projects/avr32/src/sys/avr32/avr32/switch.S#9 edit
.. //depot/projects/avr32/src/sys/avr32/include/endian.h#2 edit
.. //depot/projects/avr32/src/sys/conf/Makefile.avr32#3 edit
.. //depot/projects/avr32/src/sys/conf/files.avr32#14 edit
.. //depot/projects/avr32/src/sys/conf/kern.pre.mk#4 edit

Differences ...

==== //depot/projects/avr32/src/contrib/gcc/config/avr32/freebsd.h#4 (text+ko) ====

@@ -21,15 +21,15 @@
 
 /* $FreeBSD: src/contrib/gcc/config/mips/freebsd.h,v 1.2 2008/09/01 23:09:45 obrien Exp $ */
 
-#undef  EXTRA_SPECS
-#define	EXTRA_SPECS \
-  { "fbsd_dynamic_linker",	FBSD_DYNAMIC_LINKER}, \
-  { "fbsd_link_spec",		FBSD_LINK_SPEC }
+
+#undef  CC1_SPEC
+#define CC1_SPEC "%{profile:-p}"
+
+
+#undef  SUBTARGET_EXTRA_SPECS
+#define	SUBTARGET_EXTRA_SPECS						\
+  { "fbsd_dynamic_linker",	FBSD_DYNAMIC_LINKER},
 
-/* config/mips/mips.h defines CC1_SPEC,
-   but gives us an "out" with SUBTARGET_CC1_SPEC.  */
-#undef  SUBTARGET_CC1_SPEC
-#define SUBTARGET_CC1_SPEC "%{profile:-p}"
 
 /* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
    for the special GCC options -static and -shared, which allow us to
@@ -41,23 +41,19 @@
 
    When the -shared link option is used a final link is not being
    done.  */
-
-#define FBSD_LINK_SPEC "\
-    %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \
-    %{v:-V} \
-    %{assert*} %{R*} %{rpath*} %{defsym*} \
-    %{shared:-Bshareable %{h*} %{soname*}} \
-    %{!shared: \
-      %{!static: \
-	%{rdynamic: -export-dynamic} \
-	%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
-      %{static:-Bstatic}} \
-    %{symbolic:-Bsymbolic} "
-
 #undef	LINK_SPEC
-#define LINK_SPEC "\
-    %{mrelax|O*:%{mno-relax|O0|O1: ;:--relax}} \
-    %(fbsd_link_spec) "
+#define LINK_SPEC "							\
+    %{p:%nconsider using `-pg' instead of `-p' with gprof(1) }		\
+    %{v:-V}								\
+    %{assert*} %{R*} %{rpath*} %{defsym*}				\
+    %{shared:-Bshareable %{h*} %{soname*}}				\
+    %{!shared:								\
+      %{!static:							\
+	%{rdynamic: -export-dynamic}					\
+	%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
+      %{static:-Bstatic}}						\
+    %{symbolic:-Bsymbolic}						\
+    %{mrelax|O*:%{mno-relax|O0|O1: ;:--relax}}"
 
 /* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
    but trashed by config/mips/elf.h.  */
@@ -68,16 +64,6 @@
 #undef  ENDFILE_SPEC
 #define ENDFILE_SPEC	FBSD_ENDFILE_SPEC
 
-/* Reset our LIB_SPEC which was properly set in config/freebsd.h
-   but trashed by config/mips/elf.h.  */
-#undef  LIB_SPEC
-#define LIB_SPEC	FBSD_LIB_SPEC
-
-/* config/mips/mips.h defines CPP_SPEC, and it expects SUBTARGET_CPP_SPEC.  */
-#undef  SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
-
-
 /************************[  Target stuff  ]***********************************/
 
 /* Define the actual types of some ANSI-mandated types.
@@ -93,7 +79,7 @@
     {								\
       builtin_define ("__avr32__");				\
       builtin_define ("__AVR32__");				\
-      builtin_define ("__AVR32_ELF__");	       	        	\
+      builtin_define ("__AVR32_ELF__");				\
       builtin_define (avr32_part->macro);			\
       builtin_define (avr32_arch->macro);			\
       if (avr32_arch->uarch_type == UARCH_TYPE_AVR32A)		\
@@ -127,21 +113,4 @@
 #undef  BSS_SECTION_ASM_OP
 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
 
-/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
-   separate, explicit argument.  If you define this macro, it is used
-   in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
-   handling the required alignment of the variable.  The alignment is
-   specified as the number of bits.
-
-   Try to use function `asm_output_aligned_bss' defined in file
-   `varasm.c' when defining this macro.  */
-#undef  ASM_OUTPUT_ALIGNED_BSS
-#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
-  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
-
-/* Standard AT&T UNIX 'as' local label spelling.  */
-#undef  LOCAL_LABEL_PREFIX
-#define LOCAL_LABEL_PREFIX "."
-
-
 /************************[  Debugger stuff  ]*********************************/

==== //depot/projects/avr32/src/lib/csu/avr32/crt1.c#2 (text+ko) ====

@@ -60,8 +60,8 @@
 extern void _fini(void);
 extern void _init(void);
 extern int main(int, char **, char **);
-extern void _start(int, char **, char **, const struct Struct_Obj_Entry *,
-    void (*)(void), struct ps_strings *);
+extern void _start(int, char **, char **, struct ps_strings *,
+    const struct Struct_Obj_Entry *, void (*cleanup)(void));
 
 #ifdef GCRT
 extern void _mcleanup(void);
@@ -75,7 +75,7 @@
 struct ps_strings *__ps_strings;
 
 void
-__start(int argc, char **argv, char **env, struct ps_strings *ps_strings,
+_start(int argc, char **argv, char **env, struct ps_strings *ps_strings,
     const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void))
 {
 	const char *s;

==== //depot/projects/avr32/src/sys/avr32/avr32/switch.S#9 (text+ko) ====

@@ -81,6 +81,12 @@
 	/* Load PCB and PD address */
 	ld.w	r2, r12[TD_PCB]
 
+	/* Add ASID and V flag to kstack value */
+	ld.w	r4, r11[PMAP_ASID]
+	add	r10, r4
+	sbr	r10, AT32_SYS_TLBEHI_V
+	ld.w	r11, r11[PMAP_PD]		/* Point r11 to page directory */
+
 	/* Check if stack is in P3 */
 	ld.w	r10, r12[TD_KSTACK]
 	mov	r9, r10
@@ -88,12 +94,6 @@
 	cp	r9, 0x6
 	brne	restore_finish
 
-	/* Add ASID and V flag to kstack value */
-	ld.w	r4, r11[PMAP_ASID]
-	add	r10, r4
-	sbr	r10, AT32_SYS_TLBEHI_V
-	ld.w	r11, r11[PMAP_PD]		/* Point r11 to page directory */
-
 	sub	r9, r12, -(TD_KPTE)		/* Add KPTE offset to thread struct pointer */
 	mov	r8, KSTACK_PAGES		/* Iterate thru thru all kstack pages */
 

==== //depot/projects/avr32/src/sys/avr32/include/endian.h#2 (text+ko) ====

@@ -43,11 +43,7 @@
 #define _BIG_ENDIAN     4321    /* MSB first: 68000, ibm, net */
 #define _PDP_ENDIAN     3412    /* LSB first in word, MSW first in long */
 
-#ifdef __AVR32EB__
 #define _BYTE_ORDER	_BIG_ENDIAN
-#else
-#define	_BYTE_ORDER	_LITTLE_ENDIAN
-#endif /* __AVR32EB__ */
 
 #if __BSD_VISIBLE
 #define LITTLE_ENDIAN   _LITTLE_ENDIAN
@@ -56,21 +52,12 @@
 #define BYTE_ORDER      _BYTE_ORDER
 #endif
 
-#ifdef __AVR32EB__
 #define _QUAD_HIGHWORD 0
 #define _QUAD_LOWWORD 1
 #define __ntohl(x)	((__uint32_t)(x))
 #define __ntohs(x)	((__uint16_t)(x))
 #define __htonl(x)	((__uint32_t)(x))
 #define __htons(x)	((__uint16_t)(x))
-#else
-#define _QUAD_HIGHWORD  1
-#define _QUAD_LOWWORD 0
-#define __ntohl(x)        (__bswap32(x))
-#define __ntohs(x)        (__bswap16(x))
-#define __htonl(x)        (__bswap32(x))
-#define __htons(x)        (__bswap16(x))
-#endif /* __AVR32EB__ */
 
 #if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__)
 #define __is_constant(x)    __builtin_constant_p(x)

==== //depot/projects/avr32/src/sys/conf/Makefile.avr32#3 (text+ko) ====

@@ -14,17 +14,6 @@
 # after which config should be rerun for all machines.
 #
 
-CROSS_COMPILE=/crosstools/bin/avr32-linux-
-CC=$(CROSS_COMPILE)gcc
-LD=$(CROSS_COMPILE)ld
-OBJCOPY=$(CROSS_COMPILE)objcopy
-SIZE=$(CROSS_COMPILE)size
-
-UBOOT_MKIMAGE=/crosstools/bin/mkimage
-UBOOT_IMAGE=kernel.uboot
-UBOOT_LOAD_ADDRESS=0x10000000
-UBOOT_BOOT_ADDRESS=0x90000000
-
 # Which version of config(8) is required.
 %VERSREQ=	600004
 
@@ -42,9 +31,6 @@
 .endif
 .include "$S/conf/kern.pre.mk"
 
-CFLAGS+=-fno-pic -nostdinc -D__FreeBSD_cc_version -D__FreeBSD__
-#:ASM_CFLAGS+=-E
-
 .if !defined(DEBUG) && !defined(PROFLEVEL)
 STRIP_FLAGS = -S
 .endif

==== //depot/projects/avr32/src/sys/conf/files.avr32#14 (text+ko) ====

@@ -44,17 +44,16 @@
 
 libkern/ashldi3.c		standard
 libkern/ashrdi3.c		standard
-#libkern/avr32/muldi64.c		standard
-#libkern/divdi3.c		standard
+libkern/avr32/muldi64.c		standard
+libkern/divdi3.c		standard
 libkern/ffs.c			standard
 libkern/ffsl.c			standard
 libkern/fls.c			standard
 libkern/flsl.c			standard
-#libkern/lshrdi3.c		standard
-#libkern/moddi3.c		standard
+libkern/moddi3.c		standard
 libkern/qdivrem.c		standard
-#libkern/udivdi3.c		standard
-#libkern/umoddi3.c		standard
+libkern/udivdi3.c		standard
+libkern/umoddi3.c		standard
 libkern/memset.c		standard
 
 avr32/avr32/in_cksum.c		optional	inet

==== //depot/projects/avr32/src/sys/conf/kern.pre.mk#4 (text+ko) ====

@@ -146,8 +146,6 @@
 SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
 SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
 SYSTEM_OBJS+= hack.So
-# antab: Hack for avr32, needs libgcc for now.
-SYSTEM_OBJS+= /crosstools/lib/gcc/avr32-linux/4.2.2/libgcc.a
 .if defined(CTFMERGE)
 SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJS} vers.o
 LD+= -g


More information about the p4-projects mailing list