The following patch series is available at git://repo.or.cz/qemu/rth.git tcg-s390-2
It begins with Uli Hecht's original patch, posted by Alexander sometime last year. I then make incremental changes to (1) Make it compile -- first patch that compiles is tagged as tcg-s390-2-first-compile and is d142103... tcg-s390: Define tcg_target_reg_names. (2) Make it work -- the first patch that i386-linux-user successfully completes linux-test-user-0.2 is tagged as tcg-s390-2-first-working and is 3571f8d... tcg-s390: Implement setcond. (3) Make it work for other targets. I don't tag this, but there are lots of load/store aborts and an incorrectly division routine until 9798371... tcg-s390: Implement div2. (4) Make it work well. The balance of the patches incrementally add support for new instructions. At 7bfaa9e... tcg-s390: Query instruction extensions that are installed. I add support for detecting the instruction set extensions present in the host and then start disabling some of those new instructions that may not be present. Once things start working, each step was tested with an --enable-debug compile, and running the linux-user-test suite as well as booting the {arm,coldfire,sparc}-linux test kernels, and booting freedos. Unfortunately, each step was only built without optimization, and it is only at the end that we discovered that TCG was not properly honoring the host ABI. This is solved by the last patch, adding proper sign extensions for the 32-bit function arguments. With the final patch everything works for an optimized build as well. The current state is that the TCG compiler works for an s390x host. That is, with a 64-bit userland binary. It will *compile* for a 32-bit userland binary, but that facility is only retained for the purpose of running the s390 kvm guest. If kvm is not used, the 32-bit binary will exit with an error message. Given that this is the beginning of proper support for s390, I don't know whether bisectability is really an issue. I suppose we could fairly easily re-base the patches that touch files outside tcg/s390/ and then squash the rest, but I suspect the history may be useful. r~ Alexander Graf (2): S390 TCG target add lost chunks from the original patch Richard Henderson (60): tcg-s390: Only validate CPUTLBEntry for system mode. tcg-s390: Fix tcg_prepare_qemu_ldst for user mode. tcg-s390: Move opcode defines to tcg-target.c. s390x: Avoid _llseek. s390x: Don't use a linker script for user-only. tcg-s390: Avoid set-but-not-used werrors. tcg-s390: Mark R0 & R15 reserved. tcg-s390: R6 is a function argument register tcg-s390: Move tcg_out_mov up and use it throughout. tcg-s390: Eliminate the S constraint. tcg-s390: Add -m64 and -march to s390x compilation. tcg-s390: Define tcg_target_reg_names. tcg-s390: Update disassembler from binutils head. tcg-s390: Compute is_write in cpu_signal_handler. tcg-s390: Reorganize instruction emission tcg-s390: Use matching constraints. tcg-s390: Fixup qemu_ld/st opcodes. tcg-s390: Implement setcond. tcg-s390: Generalize the direct load/store emission. tcg-s390: Tidy branches. tcg-s390: Add tgen_calli. tcg-s390: Implement div2. tcg-s390: Re-implement tcg_out_movi. tcg-s390: Implement sign and zero-extension operations. tcg-s390: Implement bswap operations. tcg-s390: Implement rotates. tcg-s390: Use LOAD COMPLIMENT for negate. tcg-s390: Tidy unimplemented opcodes. tcg-s390: Use the extended-immediate facility for add/sub. tcg-s390: Implement immediate ANDs. tcg-s390: Implement immediate ORs. tcg-s390: Implement immediate MULs. tcg-s390: Implement immediate XORs. tcg-s390: Icache flush is a no-op. tcg-s390: Define TCG_TMP0. tcg-s390: Tidy regset initialization; use R14 as temporary. tcg-s390: Rearrange register allocation order. tcg-s390: Tidy goto_tb. tcg-s390: Allocate the code_gen_buffer near the main program. tcg-s390: Rearrange qemu_ld/st to avoid register copy. tcg-s390: Tidy tcg_prepare_qemu_ldst. tcg-s390: Tidy user qemu_ld/st. tcg-s390: Implement GUEST_BASE. tcg-s390: Query instruction extensions that are installed. tcg-s390: Conditionalize general-instruction-extension insns. tcg-s390: Conditionalize ADD IMMEDIATE instructions. tcg-s390: Conditionalize LOAD IMMEDIATE instructions. tcg-s390: Conditionalize 8 and 16 bit extensions. tcg-s390: Conditionalize AND IMMEDIATE instructions. tcg-s390: Conditionalize OR IMMEDIATE instructions. tcg-s390: Conditionalize XOR IMMEDIATE instructions. tcg-s390: Do not require the extended-immediate facility. tcg-s390: Use 16-bit branches for forward jumps. tcg-s390: Use the LOAD AND TEST instruction for compares. tcg-s390: Use the COMPARE IMMEDIATE instrucions for compares. tcg-s390: Use COMPARE AND BRANCH instructions. tcg-s390: Generalize load/store support. tcg-s390: Fix TLB comparison width. tcg-s390: Enable compile in 32-bit mode. tcg: Optionally sign-extend 32-bit arguments for 64-bit host. configure | 12 +- cpu-exec.c | 42 +- def-helper.h | 38 +- exec.c | 7 + linux-user/syscall.c | 4 +- s390-dis.c | 818 +++++++++++++--- target-i386/ops_sse_header.h | 3 + target-ppc/helper.h | 1 + tcg/s390/tcg-target.c | 2240 +++++++++++++++++++++++++++++++++++++++++- tcg/s390/tcg-target.h | 63 +- tcg/tcg-op.h | 34 +- tcg/tcg.c | 41 +- 12 files changed, 3063 insertions(+), 240 deletions(-)