Commit 3142255c62f3e69a1fa75427426a3e64b6349fbd

Authored by blueswir1
1 parent 6083f933

Sparc host update (Ben Taylor, Martin Bochnig)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2689 c046a42c-6fe2-441c-8c8c-71466251a162
Makefile
... ... @@ -8,10 +8,9 @@ include config-host.mak
8 8 BASE_CFLAGS=
9 9 BASE_LDFLAGS=
10 10  
11   -BASE_CFLAGS += $(OS_CFLAGS)
12   -ifeq ($(ARCH),sparc)
13   -BASE_CFLAGS += -mcpu=ultrasparc
14   -endif
  11 +BASE_CFLAGS += $(OS_CFLAGS) $(ARCH_CFLAGS)
  12 +BASE_LDFLAGS += $(OS_LDFLAGS) $(ARCH_LDFLAGS)
  13 +
15 14 CPPFLAGS += -I. -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
16 15 LIBS=
17 16 TOOLS=qemu-img$(EXESUF)
... ...
Makefile.target
... ... @@ -132,25 +132,25 @@ BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
132 132 endif
133 133  
134 134 ifeq ($(ARCH),sparc)
135   -ifeq ($(CONFIG_SOLARIS),yes)
136   -BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g2 -ffixed-g3
137   -BASE_LDFLAGS+=-m32
138   -OP_CFLAGS+=-fno-delayed-branch -fno-omit-frame-pointer -ffixed-i0
139   -else
140   -BASE_CFLAGS+=-mcpu=ultrasparc -m32 -ffixed-g1 -ffixed-g2 -ffixed-g3 -ffixed-g6
141   -BASE_LDFLAGS+=-m32
142   -OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
143   -HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
144   -# -static is used to avoid g1/g3 usage by the dynamic linker
145   -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
146   -endif
  135 + BASE_CFLAGS+=-ffixed-g2 -ffixed-g3
  136 + OP_CFLAGS+=-fno-delayed-branch -ffixed-i0
  137 + ifeq ($(CONFIG_SOLARIS),yes)
  138 + OP_CFLAGS+=-fno-omit-frame-pointer
  139 + else
  140 + BASE_CFLAGS+=-ffixed-g1 -ffixed-g6
  141 + HELPER_CFLAGS=$(CFLAGS) -ffixed-i0 -mflat
  142 + # -static is used to avoid g1/g3 usage by the dynamic linker
  143 + BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld -static
  144 + endif
147 145 endif
148 146  
149 147 ifeq ($(ARCH),sparc64)
150   -BASE_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
151   -BASE_LDFLAGS+=-m64
152   -BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
153   -OP_CFLAGS+=-mcpu=ultrasparc -m64 -ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7 -fno-delayed-branch -ffixed-i0
  148 + BASE_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
  149 + OP_CFLAGS+=-mcpu=ultrasparc -m64 -fno-delayed-branch -ffixed-i0
  150 + ifneq ($(CONFIG_SOLARIS),yes)
  151 + BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
  152 + OP_CFLAGS+=-ffixed-g1 -ffixed-g4 -ffixed-g5 -ffixed-g7
  153 + endif
154 154 endif
155 155  
156 156 ifeq ($(ARCH),alpha)
... ... @@ -202,8 +202,10 @@ ifdef CONFIG_DARWIN_USER
202 202 BASE_LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
203 203 endif
204 204  
205   -BASE_CFLAGS+=$(OS_CFLAGS)
206   -OP_CFLAGS+=$(OS_CFLAGS)
  205 +BASE_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
  206 +BASE_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
  207 +OP_CFLAGS+=$(OS_CFLAGS) $(ARCH_CFLAGS)
  208 +OP_LDFLAGS+=$(OS_LDFLAGS) $(ARCH_LDFLAGS)
207 209  
208 210 #########################################################
209 211  
... ... @@ -500,8 +502,10 @@ VL_LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
500 502 endif
501 503  
502 504 ifeq ($(ARCH),sparc64)
503   -VL_LDFLAGS+=-m64
504   -VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/sparc64.ld
  505 + VL_LDFLAGS+=-m64
  506 + ifneq ($(CONFIG_SOLARIS),yes)
  507 + VL_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
  508 + endif
505 509 endif
506 510  
507 511 ifdef CONFIG_WIN32
... ...
configure
... ... @@ -56,7 +56,7 @@ case "$cpu" in
56 56 s390)
57 57 cpu="s390"
58 58 ;;
59   - sparc|sun4[muv])
  59 + sparc|sun4[cdmuv])
60 60 cpu="sparc"
61 61 ;;
62 62 sparc64)
... ... @@ -266,6 +266,18 @@ for opt do
266 266 ;;
267 267 --enable-uname-release=*) uname_release="$optarg"
268 268 ;;
  269 + --sparc_cpu=*)
  270 + sparc_cpu="$optarg"
  271 + case $sparc_cpu in
  272 + v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
  273 + target_cpu="sparc"; cpu="sparc" ;;
  274 + v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
  275 + target_cpu="sparc"; cpu="sparc" ;;
  276 + v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
  277 + target_cpu="sparc64"; cpu="sparc64" ;;
  278 + *) echo "undefined SPARC architecture. Exiting";exit 1;;
  279 + esac
  280 + ;;
269 281 esac
270 282 done
271 283  
... ... @@ -279,6 +291,29 @@ fi
279 291 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
280 292 LDFLAGS="$LDFLAGS -g"
281 293  
  294 +#
  295 +# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
  296 +# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
  297 +#
  298 +case $cpu in
  299 + sparc) if test -z "$sparc_cpu" ; then
  300 + ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
  301 + ARCH_LDFLAGS="-m32"
  302 + else
  303 + ARCH_CFLAGS="${SP_CFLAGS}"
  304 + ARCH_LDFLAGS="${SP_LDFLAGS}"
  305 + fi
  306 + ;;
  307 + sparc64) if test -z "$sparc_cpu" ; then
  308 + ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
  309 + ARCH_LDFLAGS="-m64"
  310 + else
  311 + ARCH_CFLAGS="${SP_CFLAGS}"
  312 + ARCH_LDFLAGS="${SP_LDFLAGS}"
  313 + fi
  314 + ;;
  315 +esac
  316 +
282 317 if test x"$show_help" = x"yes" ; then
283 318 cat << EOF
284 319  
... ... @@ -320,6 +355,7 @@ echo &quot; --disable-darwin-user disable all darwin usermode emulation targets&quot;
320 355 echo " --fmod-lib path to FMOD library"
321 356 echo " --fmod-inc path to FMOD includes"
322 357 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
  358 +echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
323 359 echo ""
324 360 echo "NOTE: The object files are built at the place where configure is launched"
325 361 exit 1
... ... @@ -635,6 +671,9 @@ else
635 671 fmod_support=""
636 672 fi
637 673 echo "FMOD support $fmod $fmod_support"
  674 +if test -n "$sparc_cpu"; then
  675 + echo "Target Sparc Arch $sparc_cpu"
  676 +fi
638 677 echo "kqemu support $kqemu"
639 678 echo "Documentation $build_docs"
640 679 [ ! -z "$uname_release" ] && \
... ... @@ -668,6 +707,9 @@ echo &quot;HOST_CC=$host_cc&quot; &gt;&gt; $config_mak
668 707 echo "AR=$ar" >> $config_mak
669 708 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
670 709 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
  710 +echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
  711 +echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
  712 +echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
671 713 echo "CFLAGS=$CFLAGS" >> $config_mak
672 714 echo "LDFLAGS=$LDFLAGS" >> $config_mak
673 715 echo "EXESUF=$EXESUF" >> $config_mak
... ... @@ -712,7 +754,7 @@ elif test &quot;$cpu&quot; = &quot;m68k&quot; ; then
712 754 echo "ARCH=m68k" >> $config_mak
713 755 echo "#define HOST_M68K 1" >> $config_h
714 756 else
715   - echo "Unsupported CPU"
  757 + echo "Unsupported CPU = $cpu"
716 758 exit 1
717 759 fi
718 760 if test "$bigendian" = "yes" ; then
... ... @@ -744,6 +786,10 @@ if test &quot;$solaris&quot; = &quot;yes&quot; ; then
744 786 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
745 787 fi
746 788 fi
  789 +if test -n "$sparc_cpu"; then
  790 + echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
  791 + echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
  792 +fi
747 793 if test "$gdbstub" = "yes" ; then
748 794 echo "CONFIG_GDBSTUB=yes" >> $config_mak
749 795 echo "#define CONFIG_GDBSTUB 1" >> $config_h
... ...
cpu-all.h
... ... @@ -1000,7 +1000,7 @@ static inline int64_t cpu_get_real_ticks(void)
1000 1000 return val;
1001 1001 }
1002 1002  
1003   -#elif defined(__sparc_v9__)
  1003 +#elif defined(__sparc_v8plus__) || defined(__sparc_v8plusa__) || defined(__sparc_v9__)
1004 1004  
1005 1005 static inline int64_t cpu_get_real_ticks (void)
1006 1006 {
... ...