Skip to content

Commit

Permalink
tcg: initial ia64 support
Browse files Browse the repository at this point in the history
A few words about design choices:
* On IA64, instructions should be grouped by bundle, and dependencies
  between instructions declared. A first version of this code tried to
  schedule instructions automatically, but was very complex and too
  invasive for the current common TCG code (ops not ending at
  instruction boundaries, code retranslation breaking already generated
  code, etc.)  It was also not very efficient, as dependencies between
  TCG ops is not available.
  Instead the option taken by the current implementation does not try
  to fill the bundle by scheduling instructions, but by providing ops
  not available as an ia64 instruction, and by offering 22-bit constant
  loading for most of the instructions. With both options the bundle are
  filled at approximately the same level.

* Up to 128 registers can be affected to a function on IA64, but TCG
  limits this number to 64, which is actually more than enough. The
  register affectation is the following:
  - r0: used to map a constant argument with value 0
  - r1: global pointer
  - r2, r3: internal use
  - r4 to r6: not used to avoid saving them
  - r7: env structure
  - r8 to r11: free for TCG (call clobbered)
  - r12: stack pointer
  - r13: thread pointer
  - r14 to r31: free for TCG (call clobbered)
  - r32: reserved (return address)
  - r33: reserved (PFS)
  - r33 to r63: free for TCG

* The IA64 architecture has only 64-bit registers and no 32-bit
  instructions (the only exception being cmp4). Therefore 64-bit
  registers and instructions are used for 32-bit ops. The adopted
  strategy is the same as the ABI, that is the higher 32 bits are
  undefined. Most ops (and, or, add, shl, etc.) can directly use
  the 64-bit registers, while some others have to sign-extend (sar,
  div, etc.) or zero-extend (shr, divu, etc.) the register first.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
  • Loading branch information
aurel32 committed Apr 1, 2010
1 parent ebf50fb commit 477ba62
Show file tree
Hide file tree
Showing 4 changed files with 2,488 additions and 15 deletions.
20 changes: 6 additions & 14 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ elif check_define _ARCH_PPC ; then
fi
elif check_define __mips__ ; then
cpu="mips"
elif check_define __ia64__ ; then
cpu="ia64"
else
cpu=`uname -m`
fi
Expand Down Expand Up @@ -717,6 +719,9 @@ case "$cpu" in
mips*)
host_guest_base="yes"
;;
ia64*)
host_guest_base="yes"
;;
esac

[ -z "$guest_base" ] && guest_base="$host_guest_base"
Expand Down Expand Up @@ -2698,9 +2703,6 @@ alpha)
# Ensure there's only a single GP
cflags="-msmall-data $cflags"
;;
ia64)
cflags="-mno-sdata $cflags"
;;
esac

if test "$target_softmmu" = "yes" ; then
Expand Down Expand Up @@ -2745,21 +2747,11 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
# -static is used to avoid g1/g3 usage by the dynamic linker
ldflags="$linker_script -static $ldflags"
;;
ia64)
ldflags="-Wl,-G0 $linker_script -static $ldflags"
;;
i386|x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
i386|x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64|ia64)
ldflags="$linker_script $ldflags"
;;
esac
fi
if test "$target_softmmu" = "yes" ; then
case "$ARCH" in
ia64)
ldflags="-Wl,-G0 $linker_script -static $ldflags"
;;
esac
fi

echo "LDFLAGS+=$ldflags" >> $config_target_mak
echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Expand Down
2 changes: 1 addition & 1 deletion cpu-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/* CPU interfaces that are target indpendent. */

#if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__)
#if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__) || defined(__ia64__)
#define WORDS_ALIGNED
#endif

Expand Down
Loading

0 comments on commit 477ba62

Please sign in to comment.