Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGwUM-0007Jm-7Q for qemu-devel@nongnu.org; Sat, 05 Dec 2009 10:24:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGwUH-0007Hx-6a for qemu-devel@nongnu.org; Sat, 05 Dec 2009 10:24:01 -0500 Received: from [199.232.76.173] (port=41206 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGwUG-0007Hs-Ty for qemu-devel@nongnu.org; Sat, 05 Dec 2009 10:23:57 -0500 Received: from web15904.mail.cnb.yahoo.com ([202.165.103.49]:28888) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1NGwUD-0007aP-Bh for qemu-devel@nongnu.org; Sat, 05 Dec 2009 10:23:56 -0500 Message-ID: <245943.6550.qm@web15904.mail.cnb.yahoo.com> Date: Sat, 5 Dec 2009 23:23:43 +0800 (CST) From: identifier scorpio MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1643191695-1260026623=:6550" Subject: [Qemu-devel] about porting qemu to alpha platform List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --0-1643191695-1260026623=:6550 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello all!=0D =C2=A0 I'm trying to port qemu to alpha platform, and my working environment is=C2= =A0=0D an alpha xp1000 workstation (21264) that is running debian 5.=0D =C2=A0 I'v got some progress, and now it can run PC BIOS, and can launch linux 2.6= =C2=A0=0D using the linux-0.2.img given by qemu web-site. But linux got a panic when= =C2=A0=0D mounting root fs. Surely there must be something wrong in my code, or somet= hing=C2=A0=0Dout of my knowledge is omitted.=20 below is my testing command line:=0D qemu -hda /opt/linux-0.2.img -m 256 -curses=0D =C2=A0 I'v tried to find the bugs for a couple of painful days, including studying= =C2=A0=0D qemu.log, running test-i386 benchmark (all the basic x86 insn passed test, = but=0D test-i386 stops at test_exception(), reporing uncaught signal 10, to be hon= estly,=0D i don't know the real reason). I'v not debugged the linux kernel running in= qemu with gdb yet,=C2=A0=0Dit seems to be a terrible job.=0D =C2=A0 So, I post the patch and hope someone may give me some help or suggestions= =0D to find the fault, or tell me that am I doing the right thing? TIA.=0D =C2=A0 BTW, I know that alpha is disappearing, but I really hope qemu can run on i= t. Dong Weiyu. diff -urN qemu-0.10.0/cpu-all.h qemu-0.10.0.alpha/cpu-all.h --- qemu-0.10.0/cpu-all.h=C2=A0=C2=A0=C2=A0 2009-03-04 14:54:45.000000000 -= 0800 +++ qemu-0.10.0.alpha/cpu-all.h=C2=A0=C2=A0=C2=A0 2009-10-25 23:13:53.00000= 0000 -0700 @@ -22,7 +22,7 @@ =C2=A0 =C2=A0#include "qemu-common.h" =C2=A0 -#if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined= (__hppa__) +#if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined= (__hppa__) || defined(__alpha__) =C2=A0#define WORDS_ALIGNED =C2=A0#endif =C2=A0 diff -urN qemu-0.10.0/tcg/alpha/tcg-target.c qemu-0.10.0.alpha/tcg/alpha/tc= g-target.c --- qemu-0.10.0/tcg/alpha/tcg-target.c=C2=A0=C2=A0=C2=A0 1969-12-31 16:00:0= 0.000000000 -0800 +++ qemu-0.10.0.alpha/tcg/alpha/tcg-target.c=C2=A0=C2=A0=C2=A0 2009-11-26 0= 5:13:41.000000000 -0800 @@ -0,0 +1,1477 @@ +/*=0D + * Tiny Code Generator for QEMU=0D + *=0D + * Copyright (c) 2008 Fabrice Bellard=0D + *=0D + * Permission is hereby granted, free of charge, to any person obtaining a= copy=0D + * of this software and associated documentation files (the "Software"), t= o deal=0D + * in the Software without restriction, including without limitation the r= ights=0D + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll=0D + * copies of the Software, and to permit persons to whom the Software is= =0D + * furnished to do so, subject to the following conditions:=0D + *=0D + * The above copyright notice and this permission notice shall be included= in=0D + * all copies or substantial portions of the Software.=0D + *=0D + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR=0D + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY= ,=0D + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL= =0D + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER=0D + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM,=0D + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN=0D + * THE SOFTWARE.=0D + */=0D +=0D +/*=0D + * code review modification:=0D + * 1. $15 is deleted from reserved register set and add to tcg_target_reg_= alloc_order[]=0D + * 2. $25 is deleted from tcg_target_reg_alloc_order[]=0D + * 3. callee-clobbered register set bug fixed=0D + * 4. tcg_out_ld/st bug fixed=0D + * 5. translation of INDEX_op_exit_tb bug fixed=0D + * 6. translation of INDEX_op_goto_tb bug fixed=0D + * 7. tcg_out_brcond() bug fixed=0D + * 8. patch_reloc() rewritten=0D + * 9. qemu_ld/st() bug fixed=0D + * 10. mul() ???=0D + * 11. be careful about register order, like tcg_out_mov()=0D + * 12. remove INDEX_op_mov(i)_i32/i64 from tcg_out_op(), they are already = implemented in tcg.c=0D + * 13. icache flush not implemented ???=0D +*/=0D +=0D +#ifndef NDEBUG=0D +static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] =3D {= =0D +=C2=A0=C2=A0=C2=A0 "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7",=0D +=C2=A0=C2=A0=C2=A0 "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",= =0D +=C2=A0=C2=A0=C2=A0 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",= =0D +=C2=A0=C2=A0=C2=A0 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31",= =0D +};=0D +#endif=0D +=0D +/*=C2=A0=0D + * $26 ~ $31 are special, reserved,=C2=A0=0D + * and $25 is deliberately reserved for jcc operation=0D + * and $0 is usually used for return function result, better allocate it l= ater=0D + * and $15 is used for cpu_env pointer, allocate it at last=0D +*/=0D +static const int tcg_target_reg_alloc_order[] =3D {=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_1, TCG_REG_2, TCG_REG_3, TCG_REG_4, TCG_REG_5, = TCG_REG_6,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_7, TCG_REG_8, TCG_REG_22, TCG_REG_23, TCG_REG_2= 4,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_9, TCG_REG_10, TCG_REG_11, TCG_REG_12, TCG_REG_= 13, TCG_REG_14,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_16, TCG_REG_17, TCG_REG_18, TCG_REG_19, TCG_REG= _20, TCG_REG_21,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_0, TCG_REG_15=0D +};=0D +=0D +/*=0D + * according to alpha calling convention, these 6 registers are used for= =C2=A0=0D + * function parameter passing. if function has more than 6 parameters, rem= ained=0D + * ones are stored on stack.=0D +*/=0D +static const int tcg_target_call_iarg_regs[6] =3D {=C2=A0=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_16, TCG_REG_17, TCG_REG_18, TCG_REG_19, TCG_REG= _20, TCG_REG_21=0D +=C2=A0=C2=A0=C2=A0 };=0D +=0D +/*=0D + * according to alpha calling convention, $0 is used for returning functio= n result.=0D +*/=0D +static const int tcg_target_call_oarg_regs[1] =3D { TCG_REG_0 };=0D +=0D +/*=0D + * save the address of TB's epilogue.=0D +*/=0D +static uint8_t *tb_ret_addr;=0D +=0D +/*=C2=A0=0D + * op-code and func-code for jump insn=C2=A0=0D +*/=0D +#define CONTROL_CALL=C2=A0=C2=A0=C2=A0 0x01A=0D +#define CONTROL_RET=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x01A=0D +#define CONTROL_JMP=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x01A=0D +=0D +#define FUNC_JMP=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x00=0D +#define FUNC_CALL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x01=0D +#define FUNC_RET=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x02=0D +=0D +#define CONTROL_BR=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x30=0D +#define CONTROL_BSR=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x34=0D +#define CONTROL_BEQ=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x39=0D +#define CONTROL_BNE=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x3D=0D +#define CONTROL_BLT=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x3A=0D +#define CONTROL_BLE=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x3B=0D +#define CONTROL_BGT=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x3F=0D +#define CONTROL_BGE=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x3E=0D +#define CONTROL_BLBC=C2=A0=C2=A0=C2=A0 0x38=0D +#define CONTROL_BLBS=C2=A0=C2=A0=C2=A0 0x3C=0D +=0D +#define ALPHA_ARITH=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x10=0D +=0D +#define ARITH_ADDL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x00=0D +#define ARITH_SUBL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x09=0D +#define ARITH_ADDQ=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x20=0D +#define ARITH_SUBQ=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x29=0D +#define ARITH_CMPEQ=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x2D=0D +#define ARITH_CMPLT=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x4D=0D +#define ARITH_CMPLE=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x6D=0D +#define ARITH_CMPULT=C2=A0=C2=A0=C2=A0 0x1D=0D +#define ARITH_CMPULE=C2=A0=C2=A0=C2=A0 0x3D=0D +=0D +#define ALPHA_MUL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x13=0D +=0D +#define ARITH_MULL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x00=0D +#define ARITH_MULQ=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x20=0D +=0D +#define ALPHA_LOGIC=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x11=0D +=0D +#define ARITH_AND=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x00=0D +#define ARITH_BIC=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x08=0D +#define ARITH_BIS=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x20=0D +#define ARITH_ORNOT=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x28=0D +#define ARITH_XOR=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x40=0D +#define ARITH_EQV=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x48=0D +=0D +#define ALPHA_SHIFT=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x12=0D +=0D +#define ARITH_SLL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x39=0D +#define ARITH_SRL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x34=0D +#define ARITH_SRA=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x3C=0D +=0D +#define ALPHA_SEXT=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x1C=0D +=0D +#define ARITH_SEXTB=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x00=0D +#define ARITH_SEXTW=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x01=0D +=0D +#define ALPHA_LDA=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x08=0D +#define ALPHA_LDAH=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x09=0D +#define ALPHA_LDBU=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x0A=0D +#define ALPHA_LDWU=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x0C=0D +#define ALPHA_LDL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x28=0D +#define ALPHA_LDQ=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x29=0D +#define ALPHA_STB=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x0E=0D +#define ALPHA_STW=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x0D=0D +#define ALPHA_STL=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x2C=0D +#define ALPHA_STQ=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 0x2D=0D +=0D +/*=0D + * return the # of regs used for parameter passing on procedure calling.= =0D + * note that alpha use $16~$21 to transfer the first 6 paramenters of a pr= ocedure.=0D +*/=0D +static inline int tcg_target_get_call_iarg_regs_count(int flags)=0D +{=0D +=C2=A0=C2=A0=C2=A0 return 6;=0D +}=0D +=0D +/*=0D + * given constraint, return available register set. this function is calle= d once=0D + * for each op at qemu's initialization stage.=0D +*/=0D +static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_= str)=0D +{=0D +=C2=A0=C2=A0=C2=A0 const char *ct_str =3D *pct_str;=0D +=0D +=C2=A0=C2=A0=C2=A0 switch(ct_str[0])=C2=A0=0D +=C2=A0=C2=A0=C2=A0 {=0D +=C2=A0=C2=A0=C2=A0 case 'r':=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* constaint 'r' means any register = is okay */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ct->ct |=3D TCG_CT_REG;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_regset_set32(ct->u.regs, 0,= 0xffffffff);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case 'L':=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /*=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * constranit 'L' is used for qemu_ld= /st, which has 2 meanings:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * 1st, we the argument need to be al= located a register.=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * 2nd, we should reserve some regist= ers that belong to caller-clobbered=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * list for qemu_ld/st local usage, s= o these registers must not be=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * allocated to the argument that the= 'L' constraint is describing.=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 *=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * note that op qemu_ld/st has the TC= G_OPF_CALL_CLOBBER flag, and=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * tcg will free all callee-clobbered= registers before generate target=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * insn for qemu_ld/st, so we can use= these register directly without=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 * warrying about destroying their co= ntent.=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ct->ct |=3D TCG_CT_REG;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_regset_set32(ct->u.regs, 0,= 0xffffffff);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_regset_reset_reg(ct->u.regs= , TCG_REG_0);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_regset_reset_reg(ct->u.regs= , TCG_REG_16);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_regset_reset_reg(ct->u.regs= , TCG_REG_17);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_regset_reset_reg(ct->u.regs= , TCG_REG_18);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 default:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return -1;=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 ct_str++;=0D +=C2=A0=C2=A0=C2=A0 *pct_str =3D ct_str;=0D +=C2=A0=C2=A0=C2=A0 return 0;=0D +}=0D +=0D +/*=0D + * whether op's input argument may use constant=C2=A0=0D +*/=0D +static inline int tcg_target_const_match( \=0D +=C2=A0=C2=A0=C2=A0 tcg_target_long val, const TCGArgConstraint *arg_ct)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int ct;=0D +=C2=A0=C2=A0=C2=A0 ct =3D arg_ct->ct;=0D +=C2=A0=C2=A0=C2=A0 if (ct & TCG_CT_CONST)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 1;=0D +=C2=A0=C2=A0=C2=A0 else=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0;=0D +}=0D +=0D +/*=0D + * construct insn with following format.=C2=A0=0D + * (suitable for conditional branch insn)=0D + *=0D + * 31=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 26 25=C2=A0=C2=A0=C2=A0 21= 20=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 0=0D + * ------------------------------------------------------=0D + * |=C2=A0=C2=A0 OpCode=C2=A0 |=C2=A0=C2=A0 Ra=C2=A0=C2=A0 |=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Disp=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=0D + * ------------------------------------------------------=0D +*/=0D +static inline void tcg_out_inst2(TCGContext *s, int Opcode, int Ra, int Di= sp)=0D +{=0D +=C2=A0=C2=A0=C2=A0 uint32_t v;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 v =3D ( ( Opcode & 0x3f ) << 26=C2=A0 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Ra & 0x1f ) << 21 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( Disp & 0x1fffff) ;=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out32(s, v);=C2=A0=C2=A0=C2=A0 =C2=A0 +}=0D +=0D +/*=0D + * construct insn with following format.=C2=A0=0D + * (used for ld/st or lda/ldah insn)=0D + *=0D + * 31=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 26 25=C2=A0=C2=A0=C2=A0 21= 20=C2=A0=C2=A0=C2=A0 16 15=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0=0D + * ------------------------------------------------------=0D + * |=C2=A0=C2=A0 OpCode=C2=A0 |=C2=A0=C2=A0 Ra=C2=A0=C2=A0 |=C2=A0=C2=A0 R= b=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0 Disp=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=0D + * ------------------------------------------------------=0D +*/=0D +static inline void tcg_out_inst3_disp(TCGContext *s, int Opcode, int Ra, i= nt Rb, int Disp)=0D +{=0D +=C2=A0=C2=A0=C2=A0 uint32_t v;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 v =3D ( ( Opcode & 0x3f ) << 26=C2=A0 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Ra & 0x1f ) << 21 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Rb & 0x1f ) << 16 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( Disp & 0xffff) ;=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out32(s, v);=C2=A0=C2=A0=C2=A0 =C2=A0 +}=0D +=0D +/*=0D + * construct insn with following format.=C2=A0=0D + * (used for jmp insn)=0D + *=0D + * 31=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 26 25=C2=A0=C2=A0=C2=A0 21= 20=C2=A0=C2=A0=C2=A0 16 15=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0=0D + * ------------------------------------------------------=0D + * |=C2=A0=C2=A0 OpCode=C2=A0 |=C2=A0=C2=A0 Ra=C2=A0=C2=A0 |=C2=A0=C2=A0 R= b=C2=A0=C2=A0 | Func |=C2=A0=C2=A0=C2=A0 Rsvd=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 |=0D + * ------------------------------------------------------=0D +*/=0D +static inline void tcg_out_inst3_func(TCGContext *s, int Opcode, int Ra, i= nt Rb, int Func, int Disp)=0D +{=0D +=C2=A0=C2=A0=C2=A0 uint32_t v;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 v =3D ( ( Opcode & 0x3f ) << 26=C2=A0 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Ra & 0x1f ) << 21 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Rb & 0x1f ) << 16 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Func & 0x3 ) << 14 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( Disp & 0x3fff) ;=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out32(s, v);=C2=A0=C2=A0=C2=A0 =C2=A0 +}=0D +=0D +/*=0D + * construct insn with following format.=C2=A0=0D + * (used for operate insn)=0D + *=0D + *=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 1=0D + * 31=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 26 25=C2=A0=C2=A0=C2=A0 21= 20=C2=A0=C2=A0=C2=A0 16 15 13 2 11=C2=A0=C2=A0=C2=A0=C2=A0 5 4=C2=A0=C2=A0= 0=0D + * ------------------------------------------------------=0D + * |=C2=A0=C2=A0 OpCode=C2=A0 |=C2=A0=C2=A0 Ra=C2=A0=C2=A0 |=C2=A0=C2=A0 R= b=C2=A0=C2=A0 | SBZ |0|=C2=A0 Func=C2=A0 | Rc=C2=A0 |=0D + * ------------------------------------------------------=0D +*/=0D +static inline void tcg_out_inst4(TCGContext *s, int Opcode, int Ra, int Rb= , int Func, int Rc)=0D +{=0D +=C2=A0=C2=A0=C2=A0 uint32_t v;=0D +=0D +=C2=A0=C2=A0=C2=A0 v =3D ( (Opcode & 0x3f) << 26=C2=A0 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Ra & 0x1f ) << 21 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Rb & 0x1f ) << 16 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Func & 0x7f ) << 5 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( Rc & 0x1f ) ;=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out32(s, v);=C2=A0=C2=A0=C2=A0 =C2=A0 +}=0D +=0D +/*=0D + * construct insn with following format.=C2=A0=0D + * (used for operate insn with immediate)=0D + *=0D + *=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 1=0D + * 31=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 26 25=C2=A0=C2=A0=C2=A0 21= 20=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 13 2 11=C2=A0=C2= =A0=C2=A0=C2=A0 5 4=C2=A0=C2=A0 0=0D + * ------------------------------------------------------=0D + * |=C2=A0=C2=A0 OpCode=C2=A0 |=C2=A0=C2=A0 Ra=C2=A0=C2=A0 |=C2=A0=C2=A0= =C2=A0=C2=A0 LIT=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |1|=C2=A0 Func=C2=A0 | Rc=C2= =A0 |=0D + * ------------------------------------------------------=0D +*/=0D +static inline void tcg_out_inst4i(TCGContext *s, int Opcode, int Ra, int L= it, int Func, int Rc)=0D +{=0D +=C2=A0=C2=A0=C2=A0 uint32_t v;=0D +=0D +=C2=A0=C2=A0=C2=A0 v =3D ( (Opcode & 0x3f) << 26=C2=A0 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Ra & 0x1f ) << 21 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Lit & 0xff ) << 13 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( ( Func & 0x7f ) << 5 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( 1 << 12 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( Rc & 0x1f ) ;=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out32(s, v);=C2=A0=C2=A0=C2=A0 =C2=A0 +}=0D +=0D +/*=0D + * mov from a reg to another=0D +*/=0D +static inline void tcg_out_mov(TCGContext *s, int Rc, int Rb)=0D +{=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 if ( Rb !=3D Rc ) {=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_LOGIC, T= CG_REG_31, Rb, ARITH_BIS, Rc);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // bis = $31, Rb, Rc=0D +=C2=A0=C2=A0=C2=A0 }=0D +}=0D +=0D +/*=0D + * mov a 64-bit immediate 'arg' to regsiter 'Ra', this function will=0D + * generate fixed length (5 insns, 20 bytes) of target insn sequence.=0D +*/=0D +static inline void tcg_out_movi_fixl( \=0D +=C2=A0=C2=A0=C2=A0 TCGContext *s, TCGType type, int Ra, tcg_target_long ar= g)=0D +{=0D +=C2=A0=C2=A0=C2=A0 if( arg & ((tcg_target_ulong)0x800000000000) )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDAH, Ra= , TCG_REG_31, (arg>>48)+1 );=0D +=C2=A0=C2=A0=C2=A0 else=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDAH, Ra= , TCG_REG_31, arg>>48 );=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // ldah Ra, a= rg<63:48>($31)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=0D +=C2=A0=C2=A0=C2=A0 if( arg & ((tcg_target_ulong)0x80000000) )=0D{ +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDA, Ra,= Ra, (arg>>32)+1 );=C2=A0=0D +=C2=A0=C2=A0=C2=A0 } +=C2=A0=C2=A0=C2=A0 else=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDA, Ra,= Ra, arg>>32 );=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // lda Ra, arg<47:32>(Ra)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, Ra, 32, ARITH_SLL, Ra);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 // sll Ra, 32, Ra=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 if( arg & ((tcg_target_ulong)0x8000) )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDAH, Ra= , Ra, (arg>>16)+1 );=C2=A0=0D +=C2=A0=C2=A0=C2=A0 else=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDAH, Ra= , Ra, arg>>16 );=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // ldah Ra, arg<31:16>(Ra)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDA, Ra, Ra, arg );=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // lda Ra, arg<15:0>(= Ra)=0D +}=0D +=0D +/*=0D + * mov 64-bit immediate 'arg' to regsiter 'Ra'. this function will=0D + * generate variable length of target insn sequence.=0D +*/=0D +static inline void tcg_out_movi( \=0D +=C2=A0=C2=A0=C2=A0 TCGContext *s, TCGType type, int Ra, tcg_target_long ar= g)=0D +{=0D +=C2=A0=C2=A0=C2=A0 if (arg =3D=3D 0) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_LOGIC, Ra, Ra= , ARITH_XOR, Ra);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // xor Ra, Ra, Ra=0D +=C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 else if( arg =3D=3D (int16_t)arg ) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDA, Ra,= TCG_REG_31, arg );=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 // lda Ra, arg<15:0>($31)=0D +=C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 else if( arg =3D=3D (int32_t)arg ) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if( arg & (1<<15) ) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_dis= p(s, ALPHA_LDAH, Ra, TCG_REG_31, (arg>>16)+1);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_dis= p(s, ALPHA_LDAH, Ra, TCG_REG_31, arg>>16);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 // ldah Ra, arg<31:16>($31)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDA, Ra,= Ra, arg );=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // lda Ra, arg<15:0>(Ra)= =0D +=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* use the most complex style of mov= ement */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi_fixl(s, type, Ra, arg);= =0D +=C2=A0=C2=A0=C2=A0 }=0D +}=0D +=0D +/*=0D + * load value in disp(Rb) to Ra.=0D +*/=0D +static inline void tcg_out_ld( \=0D +=C2=A0=C2=A0=C2=A0 TCGContext *s, TCGType type, int Ra, int Rb, tcg_target= _long disp)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int Opcode;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 if( type =3D=3D TCG_TYPE_I32) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 Opcode =3D ALPHA_LDL;=0D +=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 Opcode =3D ALPHA_LDQ;=0D +=C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 if( disp !=3D (int16_t)disp ) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* disp cannot be stored in insn dir= ectly */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi(s, type, TMP_REG, disp)= ;=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, Rb, TM= P_REG, ARITH_ADDQ, TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq R= b, TMP_REG, TMP_REG=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, Opcode, Ra, TM= P_REG, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // ldx Ra, 0(TMP_REG)=0D +=C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 else=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, Opcode, Ra, Rb= , disp);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // ldx Ra, disp(Rb)=0D +}=0D +=0D +/*=0D + * store value in Ra to disp(Rb).=0D +*/=0D +static inline void tcg_out_st( \=0D +=C2=A0=C2=A0=C2=A0 TCGContext *s, TCGType type, int Ra, int Rb, tcg_target= _long disp)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int Opcode;=0D +=0D +=C2=A0=C2=A0=C2=A0 if( type =3D=3D TCG_TYPE_I32) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 Opcode =3D ALPHA_STL;=0D +=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 Opcode =3D ALPHA_STQ;=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 if( disp !=3D (int16_t)disp ) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* disp cannot be stored in insn dir= ectly */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi(s, type, TMP_REG, disp)= ;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, Rb, TM= P_REG, ARITH_ADDQ, TMP_REG);=C2=A0=C2=A0=C2=A0 // addq Rb, TMP_REG, TMP_REG= =0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, Opcode, Ra, TM= P_REG, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // stx Ra, 0(TMP_REG)=0D +=C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 else=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, Opcode, Ra, Rb= , disp);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // stx Ra, disp(Rb)=0D +}=0D +=0D +/*=0D + * generate arithmatic instruction with immediate. Ra is used as both=0D + * input and output, and val is used as another input.=0D +*/=0D +static inline void tgen_arithi( \=0D +=C2=A0=C2=A0=C2=A0 TCGContext *s, int Opcode, int Func, int Ra, tcg_target= _long val)=0D +{=0D +=C2=A0=C2=A0=C2=A0 if (val =3D=3D (uint8_t)val) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, Opcode, Ra, val, F= unc, Ra);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // arithi Ra, #b, Ra=0D +=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, TMP_RE= G, val);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, Opcode, Ra, TMP_REG= , Func, Ra);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // arithi Ra, TMP_REG, Ra=0D +=C2=A0=C2=A0=C2=A0 }=0D +}=0D +=0D +/*=0D + * generate addq instruction with immediate.=0D +*/=0D +static void tcg_out_addi(TCGContext *s, int reg, tcg_target_long val)=0D +{=0D +=C2=A0=C2=A0=C2=A0 if (val !=3D 0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tgen_arithi(s, ALPHA_ARITH, ARI= TH_ADDQ, reg, val);=0D +}=0D +=0D +/*=0D + * generate insn to push reg onto stack.=0D +*/=0D +static inline void tcg_out_push(TCGContext *s, int reg)=0D +{=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_ARITH, TCG_REG_30, 8, ARITH_SUB= Q, TCG_REG_30);=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_STQ, reg, TCG_REG_30, 0);= =0D +}=0D +=0D +/*=0D + * generate insn to pop value from stack to reg.=0D +*/=0D +static inline void tcg_out_pop(TCGContext *s, int reg)=0D +{=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDQ, reg, TCG_REG_30, 0);= =0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_ARITH, TCG_REG_30, 8, ARITH_ADD= Q, TCG_REG_30);=0D +}=0D +=0D +static const uint8_t tcg_cond_to_jcc[10] =3D {=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_EQ] =3D ARITH_CMPEQ,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_NE] =3D ARITH_CMPEQ,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_LT] =3D ARITH_CMPLT,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_GE] =3D ARITH_CMPLT,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_LE] =3D ARITH_CMPLE,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_GT] =3D ARITH_CMPLE,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_LTU] =3D ARITH_CMPULT,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_GEU] =3D ARITH_CMPULT,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_LEU] =3D ARITH_CMPULE,=0D +=C2=A0=C2=A0=C2=A0 [TCG_COND_GTU] =3D ARITH_CMPULE=0D +};=0D +=0D +/*=0D + * called by tcg_out_reloc() when the label address is determined,=C2=A0= =0D + * i.e., label->has_value is true. what should be done is to patch=C2=A0= =0D + * the jmp insn that reference this label.=0D + *=0D + * code_ptr - position need to patch=0D + * type - relocation type=0D + * value - label address=0D + * addend - not used=0D +*/=0D +static void patch_reloc(uint8_t *code_ptr, \=0D +=C2=A0=C2=A0=C2=A0 int type, tcg_target_long value, tcg_target_long addend= )=0D +{=0D +=C2=A0=C2=A0=C2=A0 TCGContext s;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 if ( type !=3D R_ALPHA_REFQUAD)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 s.code_ptr =3D code_ptr;=0D +=C2=A0=C2=A0=C2=A0 tcg_out_movi_fixl(&s, TCG_TYPE_I64, TMP_REG, value);=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_func(&s, CONTROL_JMP, TCG_REG_31, TMP_REG= , FUNC_JMP, 0);=0D +}=0D +=0D +/*=0D + * generate insns for BR or BRCOND=C2=A0=0D + * opc must be CONTROL_BR or CONTROL_BLBC or CONTROL_BLBS=0D + * Ra fixed to TMP_REG=0D +*/=0D +static void tcg_out_jxx(TCGContext *s, int opc, int Ra, int label_index)= =0D +{=0D +=C2=A0=C2=A0=C2=A0 tcg_target_long val;=0D +=C2=A0=C2=A0=C2=A0 TCGLabel *l =3D &s->labels[label_index];=0D +=C2=A0=C2=A0=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 if ((Ra !=3D TMP_REG) ||=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (opc !=3D CONTROL_BR && opc !=3D CON= TROL_BLBC && opc !=3D CONTROL_BLBS) )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=0D +=C2=A0=C2=A0=C2=A0 if (l->has_value) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* the label address has been resolv= ed. */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 val =3D (l->u.value - (tcg_target_lo= ng)s->code_ptr - 4) >> 2;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if ( val >=3D -0x100000 && val < 0x1= 00000) {=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* if distance ca= n be put into 21-bit field */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst2(s, = opc, Ra, val);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* distance can't= be put into 21-bit field */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if ( opc !=3D CON= TROL_BR) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 tcg_out_inst2(s, opc^4, Ra, 6);=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi_fixl= (s, TCG_TYPE_I64, Ra, l->u.value);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_fun= c(s, CONTROL_JMP, TCG_REG_31, Ra, FUNC_JMP, 0);=C2=A0=C2=A0=C2=A0 // jmp $3= 1, TMP_REG, 0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 } else {=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /*=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0* if the label addr has not be= en determined, we first insert a short jmp,=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0* and then resv space (6 insns= , 24 bytes) for long jmp=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if ( opc !=3D CONTROL_BR) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst2(s, = opc^4, Ra, 6);=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* record relocation infor */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_reloc(s, s->code_ptr, R_ALPH= A_REFQUAD, label_index, 0);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 s->code_ptr +=3D 24;=0D +=C2=A0=C2=A0=C2=A0 }=0D +}=0D +=0D +/*=0D + * generate insn for INDEX_op_brcond=0D +*/=0D +static void tcg_out_brcond( TCGContext *s, int cond, \=0D +=C2=A0=C2=A0=C2=A0 TCGArg arg1, TCGArg arg2, int const_arg2, int label_ind= ex)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int Func, jcc_opc;=0D +=0D +=C2=A0=C2=A0=C2=A0 if ( cond < TCG_COND_EQ || cond > TCG_COND_GTU)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=0D +=C2=A0=C2=A0=C2=A0 /* get function code according to condition */=0D +=C2=A0=C2=A0=C2=A0 Func =3D tcg_cond_to_jcc[cond];=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 if ( const_arg2) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, TMP_RE= G, arg2);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, arg1, = TMP_REG, Func, TMP_REG);=C2=A0=C2=A0=C2=A0 // CMPxx arg1, TMP_REG, TMP_REG= =0D +=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, arg1, = arg2, Func, TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // CMPxx arg1, a= rg2, TMP_REG=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // ---------------------------------=0D +=C2=A0=C2=A0=C2=A0 //=C2=A0 cond & 1=C2=A0 |=C2=A0 TMP_REG=C2=A0 |=C2=A0 t= ake?=0D +=C2=A0=C2=A0=C2=A0 // ---------------------------------=0D +=C2=A0=C2=A0=C2=A0 //=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 not= =0D +=C2=A0=C2=A0=C2=A0 //=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 yes= =0D +=C2=A0=C2=A0=C2=A0 //=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0=C2=A0=C2=A0=C2=A0 0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 yes= =0D +=C2=A0=C2=A0=C2=A0 //=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 not= =0D +=C2=A0=C2=A0=C2=A0 // ---------------------------------=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 jcc_opc =3D (cond & 1) ? CONTROL_BLBC : CONTROL_BLBS;= =0D +=C2=A0=C2=A0=C2=A0 tcg_out_jxx(s, jcc_opc, TMP_REG, label_index);=C2=A0=C2= =A0=C2=A0 =C2=A0 +}=0D +=0D +=0D +#if defined(CONFIG_SOFTMMU)=0D +=0D +#include "../../softmmu_defs.h"=0D +=0D +static void *qemu_ld_helpers[4] =3D {=0D +=C2=A0=C2=A0=C2=A0 __ldb_mmu,=0D +=C2=A0=C2=A0=C2=A0 __ldw_mmu,=0D +=C2=A0=C2=A0=C2=A0 __ldl_mmu,=0D +=C2=A0=C2=A0=C2=A0 __ldq_mmu,=0D +};=0D +=0D +static void *qemu_st_helpers[4] =3D {=0D +=C2=A0=C2=A0=C2=A0 __stb_mmu,=0D +=C2=A0=C2=A0=C2=A0 __stw_mmu,=0D +=C2=A0=C2=A0=C2=A0 __stl_mmu,=0D +=C2=A0=C2=A0=C2=A0 __stq_mmu,=0D +};=0D +=0D +#endif=0D +=0D +/*=C2=A0=0D + * XXX: qemu_ld and qemu_st could be modified to clobber only EDX and=0D + * EAX. It will be useful once fixed registers globals are less common.=C2= =A0=0D + *=0D + * output host insn for op 'qemu_ldxx t0, t1, flags', which means fetching= value from t1 to t0.=0D + * flags gives the current CPU mode, kernel or user.=0D + *=0D + * opc argument determines the data width and extension type (zero or sign= ed), and has the=C2=A0=0D + * following layout:=0D + *=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 2=C2=A0 1=C2=A0 0=0D + * ------------------------------------=0D + * |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | E |= =C2=A0 W=C2=A0 |=0D + * ------------------------------------=0D + *=0D + * E =3D 0 means zero extention, 1 means signed extension=0D + * W =3D 0 means byte, 1 means word, 2 means dword.=0D + *=0D + * Note that VM addr space may be 32-bit or 64-bit, below, we take 32-bit = addr space as example=0D + * when doing the comment.=0D +*/=0D +static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args, int opc)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int addr_reg, data_reg, r0, r1, mem_index, s_bits, bswa= p;=0D +=0D +#if defined(CONFIG_SOFTMMU)=0D +=C2=A0=C2=A0=C2=A0 uint8_t *label1_ptr, *label2_ptr;=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 data_reg =3D *args++;=0D +=C2=A0=C2=A0=C2=A0 addr_reg =3D *args++;=0D +=C2=A0=C2=A0=C2=A0 mem_index =3D *args;=0D +=C2=A0=C2=A0=C2=A0 s_bits =3D opc & 3;=0D +=0D +=C2=A0=C2=A0=C2=A0 r0 =3D TCG_REG_16;=0D +=C2=A0=C2=A0=C2=A0 r1 =3D TCG_REG_17;=0D +=0D +#if defined(CONFIG_SOFTMMU)=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out_mov(s, r1, addr_reg);=C2=A0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_mov(s, r0, addr_reg);=C2=A0=0D +=C2=A0=0D +#if TARGET_LONG_BITS =3D=3D 32=0D +=C2=A0=C2=A0=C2=A0 /* if VM is of 32-bit arch, clear higher 32-bit of addr= */=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SLL, r0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // sll r0, 32, r0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SRL, r0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // srl r0, 32, r0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r1, 32, ARITH_SLL, r1);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // sll r0, 32, r0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r1, 32, ARITH_SRL, r1);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // srl r0, 32, r0=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 tgen_arithi(s, ALPHA_LOGIC, ARITH_AND, r0, TARGET_PAGE_= MASK | ((1 << s_bits) - 1));=C2=A0=C2=A0=C2=A0 // and r0, #b, r0=C2=A0=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // after above insn, we got the page # stored in r0.=C2= =A0 note that if VM addr space is 32 bits,=0D +=C2=A0=C2=A0=C2=A0 // then the higher 32 bits of r0 should be 0=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 //=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 32 31=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 12 11=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 1 0=0D +=C2=A0=C2=A0=C2=A0 // ----------------------------------------------------= ---------=0D +=C2=A0=C2=A0=C2=A0 //=C2=A0 ...00 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 page#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0 ...0000...=C2=A0=C2=A0=C2=A0= =C2=A0 |xx|=0D +=C2=A0=C2=A0=C2=A0 // ----------------------------------------------------= ---------=0D +=C2=A0=C2=A0=C2=A0 //=0D +=0D +=C2=A0=C2=A0=C2=A0 //=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // the following 2 host insns are tricky. note that TLB= has 256 entries,=0D +=C2=A0=C2=A0=C2=A0 // and entry is (1<|=0D +=C2=A0=C2=A0=C2=A0 //=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out_addi(s, r1, offsetof(CPUState, tlb_table[mem_in= dex][0].addr_read));=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // addq r1, offset, r1=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, r1, TCG_REG_15, ARITH_ADD= Q, r1);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq r1, $15, r1=0D +#if TARGET_LONG_BITS =3D=3D 32=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDL, TMP_REG, r1, 0);=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // ldl TMP_REG, 0(r1)=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, TMP_REG, 32, ARITH_SLL, = TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 // sll TMP_REG, 32, TMP_REG=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, TMP_REG, 32, ARITH_SRL, = TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 // srl TMP_REG, 32, TMP_REG=0D +#else=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDQ, TMP_REG, r1, 0);=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // ldq TMP_REG, 0(r1)=0D +#endif=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // now, r0 contains the page# and TMP_REG contains the = addr to tlb_entry.addr_read=0D +=C2=A0=C2=A0=C2=A0 // we below will compare them=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, TMP_REG, r0, ARITH_CMPEQ,= TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // cmpeq TMP_REG, r0, TMP_REG=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out_mov(s, r0, addr_reg);=C2=A0=0D +#if TARGET_LONG_BITS =3D=3D 32=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SLL, r0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // sll r0, 32, r0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SRL, r0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // srl r0, 32, r0=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // if equal, we jump to label1. since label1 is not res= olved yet,=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // we just record a relocation.=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 label1_ptr =3D s->code_ptr;=0D +=C2=A0=C2=A0=C2=A0 s->code_ptr +=3D 4;=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // here, unequal, TLB-miss.=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_17, mem_index);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // pass argument = 2=0D +=C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 TMP_REG, (tcg_target_long)qemu_ld_he= lpers[s_bits]);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // get helper func entry=0D +=C2=A0=C2=A0=C2=A0 tcg_out_push(s, TCG_REG_26);=0D +tcg_out_mov(s, TCG_REG_27, TMP_REG); +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_func(s, CONTROL_CALL, TCG_REG_26, TMP_REG= , FUNC_CALL, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // call helper func=0D +=C2=A0=C2=A0=C2=A0 tcg_out_pop(s, TCG_REG_26);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // after helper function call, the result of ld is save= d in $0=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 switch(opc) {=0D +=C2=A0=C2=A0=C2=A0 case 0 | 4:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_SEXT, TC= G_REG_31, TCG_REG_0, ARITH_SEXTB, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 // sextb $31, $0, data_reg=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 1 | 4:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_SEXT, TC= G_REG_31, TCG_REG_0, ARITH_SEXTW, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 // sextw $31, $0, data_reg=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 2 | 4:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, = TCG_REG_0, 32, ARITH_SLL, TCG_REG_0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // sll $0, 32, $0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, TCG_R= EG_0, 32, ARITH_SRA, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // sra $0, 32, data_reg=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 0:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, = TCG_REG_0, 56, ARITH_SLL, TCG_REG_0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // sll $0, 56, $0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, TCG_R= EG_0, 56, ARITH_SRL, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // srl $0, 56, data_reg=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 1:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, = TCG_REG_0, 48, ARITH_SLL, TCG_REG_0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // sll $0, 48, $0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, TCG_R= EG_0, 48, ARITH_SRL, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // srl $0, 48, data_reg=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 2:=0D +=C2=A0=C2=A0=C2=A0 default:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, = TCG_REG_0, 32, ARITH_SLL, TCG_REG_0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // sll $0, 32, $0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, TCG_R= EG_0, 32, ARITH_SRL, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // srl $0, 32, data_reg=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 3:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_mov(s, data_reg, TCG_REG_0);= =0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // we have done, jmp to label2. label2 is not resolved = yet,=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // we record a relocation.=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 label2_ptr =3D s->code_ptr;=0D +=C2=A0=C2=A0=C2=A0 s->code_ptr +=3D 4;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // patch jmp to label1=0D +=C2=A0=C2=A0=C2=A0 *(uint32_t *)label1_ptr =3D (uint32_t) \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 ( ( CONTROL_BNE << 26 ) | ( TMP_REG = << 21 ) \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 | ( ((s->code_ptr-label1_ptr-4)>>2) = & 0x1fffff) );=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // beq TMP_REG, disp=C2=A0=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // if we get here, a TLB entry is hit, r0 contains the = guest addr and=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // r1 contains the ptr that point to tlb_entry.addr_rea= d. what we should=0D +=C2=A0=C2=A0=C2=A0 // do is to load the tlb_entry.addend (64-bit on alpha)= and add it to=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // r0 to get the host VA=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, TMP_REG, \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 offsetof(CPUTLBEntry, addend) - offs= etof(CPUTLBEntry, addr_read));=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // TMP_REG <- distance btw addent and addr_= read=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, r1, TMP_REG, ARITH_ADDQ, = r1);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq r1,= TMP_REG, r1=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDQ, TMP_REG, r1,=C2=A0 0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // ldq TMP_REG, r1, 0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, r0, TMP_REG, ARITH_ADDQ, = r0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq r0,= TMP_REG, r0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +#else=0D +=C2=A0=C2=A0=C2=A0 r0 =3D addr_reg;=0D +#endif // endif defined(CONFIG_SOFTMMU)=0D +=0D +=0D +#ifdef TARGET_WORDS_BIGENDIAN=0D +=C2=A0=C2=A0=C2=A0 bswap =3D 1;=0D +#else=0D +=C2=A0=C2=A0=C2=A0 bswap =3D 0;=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 if ( bswap) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // when we get here, r0 contains the host VA that can b= e used to access guest PA=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 switch(opc) {=0D +=C2=A0=C2=A0=C2=A0 case 0:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDB= U, data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 // ldbu data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 0 | 4:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDB= U, data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 // ldbu data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_SEXT, TCG_REG= _31, data_reg, ARITH_SEXTB, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= // sextb $31, data_reg, data_reg=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 1:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDW= U, data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 // ldwu data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 1 | 4:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDW= U, data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 // ldwu data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_SEXT, TCG_REG= _31, data_reg, ARITH_SEXTW, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= // sextw $31, data_reg, data_reg=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 2:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDL= , data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // ldl data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, data_= reg, 32, ARITH_SLL, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // sll data_reg, 32, data_reg=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, data_= reg, 32, ARITH_SRL, data_reg);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // srl data_reg, 32, data_reg=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 2 | 4:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDL= , data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // ldl data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 3:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDQ= , data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // ldq data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 default:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +#if defined(CONFIG_SOFTMMU)=0D +=C2=A0=C2=A0=C2=A0 /* label2: */=0D +=C2=A0=C2=A0=C2=A0 *(uint32_t *)label2_ptr =3D (uint32_t)( ( CONTROL_BR <<= 26 ) \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 | ( = TCG_REG_31=C2=A0 << 21 ) |=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 ( ((= s->code_ptr-label2_ptr-4)>>2) & 0x1fffff) );=0D +#endif=0D +}=0D +=0D +static void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int addr_reg, data_reg, r0, r1, mem_index, s_bits, bswa= p;=0D +#if defined(CONFIG_SOFTMMU)=0D +=C2=A0=C2=A0=C2=A0 uint8_t *label1_ptr, *label2_ptr;=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 data_reg =3D *args++;=0D +=C2=A0=C2=A0=C2=A0 addr_reg =3D *args++;=0D +=C2=A0=C2=A0=C2=A0 mem_index =3D *args;=0D +=C2=A0=C2=A0=C2=A0 s_bits =3D opc&3;=0D +=0D +=C2=A0=C2=A0=C2=A0 r0 =3D TCG_REG_16;=0D +=C2=A0=C2=A0=C2=A0 r1 =3D TCG_REG_17;=0D +=0D +#if defined(CONFIG_SOFTMMU)=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out_mov(s, r1, addr_reg);=C2=A0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_mov(s, r0, addr_reg);=C2=A0=0D +=C2=A0=0D +#if TARGET_LONG_BITS =3D=3D 32=0D +=C2=A0=C2=A0=C2=A0 /* if VM is of 32-bit arch, clear higher 32-bit of addr= */=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SLL, r0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // sll r0, 32, r0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SRL, r0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // srl r0, 32, r0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r1, 32, ARITH_SLL, r1);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // sll r0, 32, r0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r1, 32, ARITH_SRL, r1);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // srl r0, 32, r0=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 tgen_arithi(s, ALPHA_LOGIC, ARITH_AND, r0, TARGET_PAGE_= MASK | ((1 << s_bits) - 1));=C2=A0=C2=A0=C2=A0 // and r0, #b, r0=0D +=0D +=C2=A0=C2=A0=C2=A0 tgen_arithi(s, ALPHA_SHIFT, ARITH_SRL, r1, TARGET_PAGE_= BITS - CPU_TLB_ENTRY_BITS);=C2=A0=C2=A0=C2=A0 // srl r1, #b, r1=C2=A0=C2=A0= =C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 tgen_arithi(s, ALPHA_LOGIC, ARITH_AND, r1, (CPU_TLB_SIZ= E-1) << CPU_TLB_ENTRY_BITS);=C2=A0=C2=A0=C2=A0 // and r1, #b, r1=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out_addi(s, r1, offsetof(CPUState, tlb_table[mem_in= dex][0].addr_write));=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq r1, offs= et, r1=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, r1, TCG_REG_15, ARITH_ADD= Q, r1);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq r1, $15, r1=0D +=0D +#if TARGET_LONG_BITS =3D=3D 32=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDL, TMP_REG, r1, 0);=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // ldl TMP_REG, 0(r1)=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, TMP_REG, 32, ARITH_SLL, = TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 // sll TMP_REG, 32, TMP_REG=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, TMP_REG, 32, ARITH_SRL, = TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 // srl TMP_REG, 32, TMP_REG=0D +#else=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDQ, TMP_REG, r1, 0);=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // ldq TMP_REG, 0(r1)=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // now, r0 contains the page# and TMP_REG contains the = addr to tlb_entry.addr_read=0D +=C2=A0=C2=A0=C2=A0 // we below will compare them=0D +=C2=A0=C2=A0=C2=A0 //=C2=A0=C2=A0=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, TMP_REG, r0, ARITH_CMPEQ,= TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // cmpeq TMP_REG, r0, TMP_REG=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out_mov(s, r0, addr_reg);=C2=A0=0D +#if TARGET_LONG_BITS =3D=3D 32=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SLL, r0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // sll r0, 32, r0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SRL, r0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 // srl r0, 32, r0=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // if equal, we jump to label1. since label1 is not res= olved yet,=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // we just record a relocation.=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 label1_ptr =3D s->code_ptr;=0D +=C2=A0=C2=A0=C2=A0 s->code_ptr +=3D 4;=0D +=0D +=C2=A0=C2=A0=C2=A0 // here, unequal, TLB-miss, ...=0D +=C2=A0=C2=A0=C2=A0 tcg_out_mov(s, TCG_REG_17, data_reg);=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // pass arg= ument 2=0D +=C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_18, mem_index);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // pass argument = 3=0D +=C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 TMP_REG, (tcg_target_long)qemu_st_he= lpers[s_bits]);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // get helper func entry=0D +=C2=A0=C2=A0=C2=A0 tcg_out_push(s, TCG_REG_26);=0D +tcg_out_mov(s, TCG_REG_27,TMP_REG); +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_func(s, CONTROL_CALL, TCG_REG_26, TMP_REG= , FUNC_CALL, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // call helper func=0D +=C2=A0=C2=A0=C2=A0 tcg_out_pop(s, TCG_REG_26);=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // we have done, jmp to label2. label2 is not resolved = yet,=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // we record a relocation.=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 label2_ptr =3D s->code_ptr;=0D +=C2=A0=C2=A0=C2=A0 s->code_ptr +=3D 4;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // patch jmp to label1=0D +=C2=A0=C2=A0=C2=A0 *(uint32_t *)label1_ptr =3D (uint32_t) \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 ( ( CONTROL_BNE << 26) | ( TMP_REG= =C2=A0 << 21 )=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 | ( ((s->code_ptr-label1_ptr-4)>>2) = & 0x1fffff) );=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 // bne TMP_REG, disp=C2=A0=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // if we get here, a TLB entry is hit, r0 contains the = guest addr and=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // r1 contains the ptr that point to tlb_entry.addr_rea= d. what we should=0D +=C2=A0=C2=A0=C2=A0 // do is to load the tlb_entry.addend (64-bit on alpha)= and add it to=C2=A0=0D +=C2=A0=C2=A0=C2=A0 // r0 to get the host VA=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, TMP_REG, \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 offsetof(CPUTLBEntry, addend) - offs= etof(CPUTLBEntry, addr_write));=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // TMP_REG <- distance btw addent and addr_= write=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, r1, TMP_REG, ARITH_ADDQ, = r1);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq r1,= TMP_REG, r1=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_LDQ, TMP_REG, r1,=C2=A0 0);= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // ldq TMP_REG, r1, 0=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, r0, TMP_REG, ARITH_ADDQ, = r0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq r0,= TMP_REG, r0=0D +=0D +#else=0D +=C2=A0=C2=A0=C2=A0 r0 =3D addr_reg;=0D +#endif=0D +=0D +#ifdef TARGET_WORDS_BIGENDIAN=0D +=C2=A0=C2=A0=C2=A0 bswap =3D 1;=0D +#else=0D +=C2=A0=C2=A0=C2=A0 bswap =3D 0;=0D +#endif=0D +=0D +=C2=A0=C2=A0=C2=A0 if ( bswap) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 // when we get here, r0 contains the host VA that can b= e used to access guest PA=0D +=C2=A0=C2=A0=C2=A0 //=0D +=C2=A0=C2=A0=C2=A0 switch(opc) {=0D +=C2=A0=C2=A0=C2=A0 case 0:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_STB= , data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // stb data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 1:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_STW= , data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // stw data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 2:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_STL= , data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // stl data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 3:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, ALPHA_STQ= , data_reg, r0, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 // stq data_reg, 0(r0)=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 default:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +#if defined(CONFIG_SOFTMMU)=0D +=C2=A0=C2=A0=C2=A0 /* label2: */=0D +=C2=A0=C2=A0=C2=A0 *(uint32_t *)label2_ptr =3D (uint32_t)( ( CONTROL_BR <<= 26 ) \=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 | ( TCG_REG_31=C2=A0 << 21 ) | ( ((s= ->code_ptr-label2_ptr-4)>>2) & 0x1fffff));=0D +#endif=0D +}=0D +=0D +static inline void tgen_ldxx( TCGContext *s, int Ra, int Rb, tcg_target_lo= ng disp, int flags)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int opc_array[4] =3D { ALPHA_LDBU, ALPHA_LDWU, ALPHA_LD= L, ALPHA_LDQ};=0D +=C2=A0=C2=A0=C2=A0 int opc =3D opc_array[flags & 3];=0D +=0D +=C2=A0=C2=A0=C2=A0 if( disp !=3D (int16_t)disp ) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* disp cannot be stored in insn dir= ectly */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, TMP_RE= G, disp);=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, Rb, TM= P_REG, ARITH_ADDQ, TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // addq r, TMP_REG, TMP_REG= =0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, opc, Ra, TMP_R= EG, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // ldx ret, 0(TMP_REG)=0D +=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, opc, Ra, Rb, d= isp);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // ldx ret, disp(r)=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 switch ( flags & 7)=C2=A0=C2=A0=C2=A0 {=0D +=C2=A0=C2=A0=C2=A0 case 0:=0D +=C2=A0=C2=A0=C2=A0 case 1:=0D +=C2=A0=C2=A0=C2=A0 case 2|4:=0D +=C2=A0=C2=A0=C2=A0 case 3:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 0|4:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_SEXT, TCG_REG= _31, Ra, ARITH_SEXTB, Ra);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 // sextb $31, ra, ra=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 1|4:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_SEXT, TCG_REG= _31, Ra, ARITH_SEXTW, Ra);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 // sextw $31, ra, ra=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case 2:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, Ra, 3= 2, ARITH_SLL, Ra);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // sll ret, 32, re= t=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, Ra, 3= 2, ARITH_SRL, Ra);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // srl ret, 32, re= t=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 default:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 }=0D +}=0D +=0D +static inline void tgen_stxx( TCGContext *s, int Ra, int Rb, tcg_target_lo= ng disp, int flags)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int opc_array[4] =3D { ALPHA_STB, ALPHA_STW, ALPHA_STL,= ALPHA_STQ};=0D +=C2=A0=C2=A0=C2=A0 int opc =3D opc_array[flags & 3];=0D +=0D +=C2=A0=C2=A0=C2=A0 if( disp !=3D (int16_t)disp ) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* disp cannot be stored in insn dir= ectly */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, TMP_RE= G, disp);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4(s, ALPHA_ARITH, Rb, TM= P_REG, ARITH_ADDQ, TMP_REG);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 // addq Rb, TMP_REG, TMP_REG=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, opc, Ra, TMP_R= EG, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 // stx Ra, 0(TMP_REG)=0D +=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_disp(s, opc, Ra, Rb, d= isp);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 // stx Ra, disp(Rb)=0D +=C2=A0=C2=A0=C2=A0 }=0D +}=0D +=0D +static inline void tcg_out_op(TCGContext *s, \=0D +=C2=A0=C2=A0=C2=A0 int opc, const TCGArg *args, const int *const_args)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int oc, c;=0D +=C2=A0=C2=A0=C2=A0 switch(opc)=C2=A0=0D +=C2=A0=C2=A0=C2=A0 {=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_exit_tb:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /*=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0* exit_tb t0, where t0 is alwa= ys constant and should be returned to engine=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0* since we'll back to engine s= oon, $0 and $1 will never be used=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, T= CG_REG_0, args[0]);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi(s, TCG_TYPE_I64, TMP_RE= G, (tcg_target_long)tb_ret_addr);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_func(s, CONTROL_JMP, T= CG_REG_31, TMP_REG, FUNC_JMP, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 // jmp $31, TMP_REG, hint=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_goto_tb:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* goto_tb idx, where idx is constan= t 0 or 1, indicating the branch # */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (s->tb_jmp_offset) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* we don't suppo= rt direct jmp */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_abo= rt();=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* indirect jump = method */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_movi( s, TCG_TYPE_I64, TMP_R= EG, (tcg_target_long)(s->tb_next + args[0])); +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_ld( s, TCG_TYPE_I64, TMP_REG= , TMP_REG, 0); +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_func(s, CONTROL_JMP, T= CG_REG_31, TMP_REG, FUNC_JMP, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // j= mp $31, TMP_REG, hint=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 s->tb_next_offset[args[0]] =3D = s->code_ptr - s->code_buf;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_call:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* call ptr, where pt= r has be stored in args[0] */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (const_args[0]) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_push( s, = TCG_REG_26);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_mov( s, T= CG_REG_27, args[0]); +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_fun= c(s, CONTROL_CALL, TCG_REG_26, args[0], FUNC_CALL, 0);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_pop( s, T= CG_REG_26);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_jmp:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* jmp t0, where t0 gives the target= address */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 if (const_args[0]) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst3_fun= c(s, CONTROL_JMP, TCG_REG_31, args[0], FUNC_JMP, 0);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_br:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* br idx, where idx gives the label= index */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_jxx(s, CONTROL_BR, TMP_= REG, args[0]);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_mov_i32:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_mov_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* mov_i32/i64 t0, t1, implemented i= n tcg.c:tcg_reg_alloc_mov() */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_movi_i32:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_movi_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* movi_i32/i64 t0, t1, implemented = in tcg.c:tcg_reg_alloc_movi() */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld8u_i32:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld8u_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* ld8u_i32/i64 t0, t1, offset */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tgen_ldxx( s, args[0], args[1], args= [2], 0);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld8s_i32:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld8s_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* ld8s_i32/i64 t0, t1, offset */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tgen_ldxx( s, args[0], args[1], args= [2], 0|4);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld16u_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld16u_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* ld16u_i32/i64 t0, t1, offset */= =0D +=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tgen_ldxx( s, args[0], args[1= ], args[2], 1);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld16s_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld16s_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* ld16s_i32/i64 t0, t1, offset */= =0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tgen_ldxx( s, args[0], args[1], args= [2], 1|4);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld32u_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* ld32u_i64 t0, t1, offset */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tgen_ldxx( s, args[0], args[1],= args[2], 2);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld_i32:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld32s_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* ld_i32 t0, t1, offset or ld32s_i6= 4 t0, t1, offset */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tgen_ldxx( s, args[0], args[1], args= [2], 2|4);=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_ld_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* ld_i32 t0, t1, offset */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tgen_ldxx( s, args[0], args[1],= args[2], 3);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 case INDEX_op_st8_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_st8_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* st8_i32/i64 t0, t1, offset */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tgen_stxx( s, args[0], args[1], args= [2], 0);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_st16_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_st16_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* st16_i32/i64 t0, t1, offset */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tgen_stxx( s, args[0], args[1], args= [2], 1);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_st_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_st32_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* st_i32/st32_i64 t0, t1, offset */= =0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tgen_stxx( s, args[0], args[1],= args[2], 2);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_st_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* st_i64 t0, t1, offset */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tgen_stxx( s, args[0], args[1],= args[2], 3);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_add_i32:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* add_i32 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_ARITH;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_ADDL;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_add_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* add_i64 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_ARITH;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_ADDQ;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_sub_i32:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* sub_i32 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_ARITH;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_SUBL;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_sub_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* sub_i84 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_ARITH;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_SUBQ;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_mul_i32:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* mul_i32 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_MUL;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_MULL;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_mul_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* mul_i64 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_MUL;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_MULQ;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_and_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_and_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* and_i32/i64 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_LOGIC;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_AND;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_or_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_or_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* or_i32/i64 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_LOGIC;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_BIS;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_xor_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_xor_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* xor_i32/i64 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_LOGIC;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_XOR;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_shl_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_shl_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* shl_i32/i64 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_SHIFT;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_SLL;=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_shr_i32:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, args[= 0], 32, ARITH_SLL, args[0]); +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, args[= 0], 32, ARITH_SRL, args[0]); +=C2=A0=C2=A0=C2=A0 case INDEX_op_shr_i64:=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* shr_i32/i64 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_SHIFT;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_SRL;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto gen_arith;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_sar_i32:=0D=C2=A0=C2=A0=C2=A0=20 +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, args[= 0], 32, ARITH_SLL, args[0]); +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_inst4i(s, ALPHA_SHIFT, args[= 0], 32, ARITH_SRA, args[0]); +=C2=A0=C2=A0=C2=A0 case INDEX_op_sar_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* sar_i32/i64 t0, t1, t2 */=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 oc =3D ALPHA_SHIFT;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 c =3D ARITH_SRA;=0D +=C2=A0=C2=A0=C2=A0 gen_arith:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (const_args[2]) {=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tgen_ar= ithi(s, oc, c, args[0], args[2]);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } else {=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out= _inst4(s, oc, args[0], args[2], c, args[0]);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_brcond_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_brcond_i64:=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* brcond_i32/i64 t0, t1, cond, labe= l */=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_brcond(s, args[2], args= [0], args[1], const_args[1], args[3]);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_ld8u:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_ld(s, args, 0);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_ld8s:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_ld(s, args, 0 | 4)= ;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_ld16u:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_ld(s, args, 1);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_ld16s:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_ld(s, args, 1 | 4)= ;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_ld32u:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_ld(s, args, 2);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_ld32s:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_ld(s, args, 2 | 4)= ;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_ld64:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_ld(s, args, 3);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_st8:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_st(s, args, 0);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_st16:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_st(s, args, 1);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_st32:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_st(s, args, 2);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_qemu_st64:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_qemu_st(s, args, 3);=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 break;=0D +=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_div2_i32:=0D +=C2=A0=C2=A0=C2=A0 case INDEX_op_divu2_i32:=0D +=C2=A0=C2=A0=C2=A0 default:=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=C2=A0=C2=A0=C2=A0 }=0D + +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out= _inst4(s, ALPHA_LOGIC, 31, 31, ARITH_AND, 31); +}=0D +=0D +static const TCGTargetOpDef alpha_op_defs[] =3D {=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_exit_tb, { } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_goto_tb, { } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_call, { "r" } }, +=C2=A0=C2=A0=C2=A0 { INDEX_op_jmp, { "r" } }, +=C2=A0=C2=A0=C2=A0 { INDEX_op_br, { } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_mov_i32, { "r", "r" } }, +=C2=A0=C2=A0=C2=A0 { INDEX_op_movi_i32, { "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld8u_i32, { "r", "r" } }, +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld8s_i32, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld16u_i32, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld16s_i32, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld_i32, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_st8_i32, { "r", "r" } }, +=C2=A0=C2=A0=C2=A0 { INDEX_op_st16_i32, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_st_i32, { "r", "r" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_add_i32, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_mul_i32, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 //{ INDEX_op_div2_i32, { "a", "d", "0", "1", "r" } },= =0D +=C2=A0=C2=A0=C2=A0 //{ INDEX_op_divu2_i32, { "a", "d", "0", "1", "r" } },= =0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_sub_i32, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_and_i32, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_or_i32, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_xor_i32, { "r", "0", "ri" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_shl_i32, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_shr_i32, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_sar_i32, { "r", "0", "ri" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_brcond_i32, { "r", "ri" } },=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0 +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_mov_i64, { "r", "r" } },=C2=A0=C2=A0=C2=A0 = =C2=A0 +=C2=A0=C2=A0=C2=A0 { INDEX_op_movi_i64, { "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld8u_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld8s_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld16u_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld16s_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld32u_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld32s_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_ld_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_st8_i64, { "r", "r" } },=C2=A0=C2=A0=C2=A0 = =C2=A0 +=C2=A0=C2=A0=C2=A0 { INDEX_op_st16_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_st32_i64, { "r", "r" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_st_i64, { "r", "r" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_add_i64, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_mul_i64, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 //{ INDEX_op_div2_i64, { "a", "d", "0", "1", "r" } },= =0D +=C2=A0=C2=A0=C2=A0 //{ INDEX_op_divu2_i64, { "a", "d", "0", "1", "r" } },= =0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_sub_i64, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_and_i64, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_or_i64, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_xor_i64, { "r", "0", "ri" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_shl_i64, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_shr_i64, { "r", "0", "ri" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_sar_i64, { "r", "0", "ri" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_brcond_i64, { "r", "ri" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_ld8u, { "r", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_ld8s, { "r", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_ld16u, { "r", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_ld16s, { "r", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_ld32u, { "r", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_ld32s, { "r", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_ld64, { "r", "L" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_st8, { "L", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_st16, { "L", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_st32, { "L", "L" } },=0D +=C2=A0=C2=A0=C2=A0 { INDEX_op_qemu_st64, { "L", "L", "L" } },=0D +=0D +=C2=A0=C2=A0=C2=A0 { -1 },=0D +};=0D +=0D +=0D +static int tcg_target_callee_save_regs[] =3D {=0D +=C2=A0=C2=A0=C2=A0 /* TCG_REG_15, */=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 // used for the global env, so no ne= ed to save=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_9,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_10,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_11,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_12,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_13,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_14=0D +};=0D +=0D +/*=0D + * Generate global QEMU prologue and epilogue code=C2=A0=0D +*/=0D +void tcg_target_qemu_prologue(TCGContext *s)=0D +{=0D +=C2=A0=C2=A0=C2=A0 int i, frame_size, push_size, stack_addend;=0D +=C2=A0=C2=A0=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 /* TB prologue */=0D +/*printf("TB prologue @ %lx\n", s->code_ptr);*/ +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 /* save TCG_REG_26 */=0D +=C2=A0=C2=A0=C2=A0 tcg_out_push(s, TCG_REG_26);=0D +=0D +=C2=A0=C2=A0=C2=A0 /* save all callee saved registers */=0D +=C2=A0=C2=A0=C2=A0 for(i =3D 0; i < ARRAY_SIZE(tcg_target_callee_save_regs= ); i++) {=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 tcg_out_push(s, tcg_target_callee_sa= ve_regs[i]);=0D +=C2=A0=C2=A0=C2=A0 }=0D +=C2=A0=C2=A0=C2=A0 =C2=A0 +=C2=A0=C2=A0=C2=A0 /* reserve some stack space */=0D +=C2=A0=C2=A0=C2=A0 push_size =3D 8 + (1 + ARRAY_SIZE(tcg_target_callee_sav= e_regs)) * 8;=0D +=C2=A0=C2=A0=C2=A0 frame_size =3D push_size + TCG_STATIC_CALL_ARGS_SIZE;= =0D +=C2=A0=C2=A0=C2=A0 frame_size =3D (frame_size + TCG_TARGET_STACK_ALIGN - 1= ) & ~(TCG_TARGET_STACK_ALIGN - 1);=0D +=C2=A0=C2=A0=C2=A0 stack_addend =3D frame_size - push_size;=0D +=C2=A0=C2=A0=C2=A0 tcg_out_addi(s, TCG_REG_30, -stack_addend);=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_func(s, CONTROL_JMP, TCG_REG_31, TCG_REG_= 16, FUNC_JMP, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* jmp $16 */=0D +=0D +=C2=A0=C2=A0=C2=A0 /* TB epilogue */=0D +=C2=A0=C2=A0=C2=A0 tb_ret_addr =3D s->code_ptr;=0D +=C2=A0=C2=A0=C2=A0 tcg_out_addi(s, TCG_REG_30, stack_addend);=0D +=C2=A0=C2=A0=C2=A0 for(i =3D ARRAY_SIZE(tcg_target_callee_save_regs) - 1; = i >=3D 0; i--) {=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_out_pop(s, tcg_target_calle= e_save_regs[i]);=0D +=C2=A0=C2=A0=C2=A0 }=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_out_pop(s, TCG_REG_26);=0D +=C2=A0=C2=A0=C2=A0 tcg_out_inst3_func(s, CONTROL_RET, TCG_REG_31, TCG_REG_= 26, FUNC_RET, 0);=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 /* ret */=0D +}=0D +=0D +=0D +void tcg_target_init(TCGContext *s)=0D +{=0D +=C2=A0=C2=A0=C2=A0 /* fail safe */=0D +=C2=A0=C2=A0=C2=A0 if ((1 << CPU_TLB_ENTRY_BITS) !=3D sizeof(CPUTLBEntry))= =0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tcg_abort();=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32= ], 0, 0xffffffff); +=C2=A0=C2=A0=C2=A0 tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64= ], 0, 0xffffffff);=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set32(tcg_target_call_clobber_regs, 0,=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (1 << TCG_REG_1=C2=A0 ) | (1 << TCG_= REG_2 ) | (1 << TCG_REG_3=C2=A0 ) | (1 << TCG_REG_4 ) |=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (1 << TCG_REG_5=C2=A0 ) | (1 << TCG_= REG_6 ) | (1 << TCG_REG_7=C2=A0 ) | (1 << TCG_REG_8 ) |=C2=A0=0D +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (1 << TCG_REG_22) | (1 << TCG_REG_23= ) | (1 << TCG_REG_24) | (1 << TCG_REG_25) |=C2=A0=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (1 << TCG_REG_16) | (1 << TCG_REG_17) | (1 << TCG_REG_18) | (1 << TC= G_REG_19) |=C2=A0=0D +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (1 << TCG_REG_20) | (1 << TCG_REG_21) | (1 << TCG_REG_0 ));=0D +=C2=A0=C2=A0=C2=A0=C2=A0=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_clear(s->reserved_regs);=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set_reg(s->reserved_regs, TCG_REG_26);=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set_reg(s->reserved_regs, TCG_REG_27);=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set_reg(s->reserved_regs, TCG_REG_28);=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set_reg(s->reserved_regs, TCG_REG_29);=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set_reg(s->reserved_regs, TCG_REG_30);=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set_reg(s->reserved_regs, TCG_REG_31);=C2=A0= =C2=A0=C2=A0 // $15, $26~$31 not alloced by tcg.c=0D +=C2=A0=C2=A0=C2=A0 tcg_regset_set_reg(s->reserved_regs, TMP_REG);=C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 // reserved register for used in this file=0D +=0D +=C2=A0=C2=A0=C2=A0 tcg_add_target_add_op_defs(alpha_op_defs);=0D +=C2=A0=C2=A0=C2=A0 printf("tcg_init called.\n"); +}=0D +=0D diff -urN qemu-0.10.0/tcg/alpha/tcg-target.h qemu-0.10.0.alpha/tcg/alpha/tc= g-target.h --- qemu-0.10.0/tcg/alpha/tcg-target.h=C2=A0=C2=A0=C2=A0 1969-12-31 16:00:0= 0.000000000 -0800 +++ qemu-0.10.0.alpha/tcg/alpha/tcg-target.h=C2=A0=C2=A0=C2=A0 2009-10-23 2= 3:09:46.000000000 -0700 @@ -0,0 +1,60 @@ +/*=0D + * Tiny Code Generator for QEMU=0D + *=0D + * Copyright (c) 2008 Fabrice Bellard=0D + *=0D + * Permission is hereby granted, free of charge, to any person obtaining a= copy=0D + * of this software and associated documentation files (the "Software"), t= o deal=0D + * in the Software without restriction, including without limitation the r= ights=0D + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll=0D + * copies of the Software, and to permit persons to whom the Software is= =0D + * furnished to do so, subject to the following conditions:=0D + *=0D + * The above copyright notice and this permission notice shall be included= in=0D + * all copies or substantial portions of the Software.=0D + *=0D + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR=0D + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY= ,=0D + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL= =0D + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER=0D + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM,=0D + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN=0D + * THE SOFTWARE.=0D + */=0D +#define TCG_TARGET_ALPHA 1=0D +=0D +#define TCG_TARGET_REG_BITS 64=0D +=0D +#define TCG_TARGET_NB_REGS 32=0D +=0D +enum {=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_0 =3D 0, TCG_REG_1, TCG_REG_2, TCG_REG_3,=0D + =C2=A0=C2=A0=C2=A0 TCG_REG_4, TCG_REG_5, TCG_REG_6, TCG_REG_7,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_8, TCG_REG_9, TCG_REG_10, TCG_REG_11,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_12, TCG_REG_13, TCG_REG_14, TCG_REG_15,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_16, TCG_REG_17, TCG_REG_18, TCG_REG_19,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_20, TCG_REG_21, TCG_REG_22, TCG_REG_23,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_24, TCG_REG_25, TCG_REG_26, TCG_REG_27,=0D +=C2=A0=C2=A0=C2=A0 TCG_REG_28, TCG_REG_29, TCG_REG_30, TCG_REG_31=0D +};=0D +=0D +/* used for function call generation */=0D +#define TCG_REG_CALL_STACK TCG_REG_30=C2=A0=0D +#define TCG_TARGET_STACK_ALIGN 16=0D +#define TCG_TARGET_CALL_STACK_OFFSET 0=0D +=0D +/* Note: must be synced with dyngen-exec.h */=0D +#define TCG_AREG0 TCG_REG_15=0D +#define TCG_AREG1 TCG_REG_9=0D +#define TCG_AREG2 TCG_REG_10=0D +#define TCG_AREG3 TCG_REG_11=0D +#define TCG_AREG4 TCG_REG_12=0D +#define TCG_AREG5 TCG_REG_13=0D +#define TCG_AREG6 TCG_REG_14=0D +=0D +#define TMP_REG TCG_REG_25=0D +=0D +static inline void flush_icache_range(unsigned long start, unsigned long s= top)=0D +{ +=C2=A0=C2=A0=C2=A0 asm("call_pal 0x86"); +}=0D =0A=0A=0A ___________________________________________________________ = =0A =E5=A5=BD=E7=8E=A9=E8=B4=BA=E5=8D=A1=E7=AD=89=E4=BD=A0=E5=8F=91=EF=BC= =8C=E9=82=AE=E7=AE=B1=E8=B4=BA=E5=8D=A1=E5=85=A8=E6=96=B0=E4=B8=8A=E7=BA=BF= =EF=BC=81 =0Ahttp://card.mail.cn.yahoo.com/ --0-1643191695-1260026623=:6550 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello all!=0D
 
I'm trying to port= qemu to alpha platform, and my working environment is =0D
an alpha= xp1000 workstation (21264) that is running debian 5.=0D
 
I'v g= ot some progress, and now it can run PC BIOS, and can launch linux 2.6 = ;=0D
using the linux-0.2.img given by qemu web-site. But linux got a pan= ic when =0D
mounting root fs. Surely there must be something wrong = in my code, or something =0Dout of my knowledge is omitted.

be= low is my testing command line:=0D

qemu -hda /opt/linux-0.2.img -m 2= 56 -curses=0D
 
I'v tried to find the bugs for a couple of painf= ul days, including studying =0D
qemu.log, running test-i386 benchma= rk (all the basic x86 insn passed test, but=0D
test-i386 stops at test_e= xception(), reporing uncaught signal 10, to be honestly,=0D
i don't know= the real reason). I'v not debugged the linux kernel running in qemu with gdb yet, =0Dit see= ms to be a terrible job.=0D
 
So, I post the patch and hope some= one may give me some help or suggestions=0D
to find the fault, or tell m= e that am I doing the right thing? TIA.=0D
 
BTW, I know that al= pha is disappearing, but I really hope qemu can run on it.

Dong Weiy= u.


diff -urN qemu-0.10.0/cpu-all.h qemu-0.10.0.alpha/cpu-all.h--- qemu-0.10.0/cpu-all.h    2009-03-04 14:54:45.000000000= -0800
+++ qemu-0.10.0.alpha/cpu-all.h    2009-10-25 23:1= 3:53.000000000 -0700
@@ -22,7 +22,7 @@
 
 #include "qemu= -common.h"
 
-#if defined(__arm__) || defined(__sparc__) || defi= ned(__mips__) || defined(__hppa__)
+#if defined(__arm__) || defined(__sp= arc__) || defined(__mips__) || defined(__hppa__) || defined(__alpha__)
&= nbsp;#define WORDS_ALIGNED
 #endif
 
diff -urN qemu-0.10.0/tcg/alpha/tcg-target.c qemu-0.10.0.alpha/tcg/alpha/tcg-target.= c
--- qemu-0.10.0/tcg/alpha/tcg-target.c    1969-12-31 16= :00:00.000000000 -0800
+++ qemu-0.10.0.alpha/tcg/alpha/tcg-target.c = ;   2009-11-26 05:13:41.000000000 -0800
@@ -0,0 +1,1477 @@
= +/*=0D
+ * Tiny Code Generator for QEMU=0D
+ *=0D
+ * Copyright (c= ) 2008 Fabrice Bellard=0D
+ *=0D
+ * Permission is hereby granted, fr= ee of charge, to any person obtaining a copy=0D
+ * of this software and= associated documentation files (the "Software"), to deal=0D
+ * in the = Software without restriction, including without limitation the rights=0D+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or s= ell=0D
+ * copies of the Software, and to permit persons to whom the Sof= tware is=0D
+ * furnished to do so, subject to the following conditions:= =0D
+ *=0D
+ * The above copyright notice and this permission notice = shall be included in=0D
+ * all copies or substantial portions of the Software.=0D
+ *= =0D
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, = EXPRESS OR=0D
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES O= F MERCHANTABILITY,=0D
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRIN= GEMENT. IN NO EVENT SHALL=0D
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIA= BLE FOR ANY CLAIM, DAMAGES OR OTHER=0D
+ * LIABILITY, WHETHER IN AN ACTI= ON OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,=0D
+ * OUT OF OR IN CON= NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN=0D
+ * THE SOF= TWARE.=0D
+ */=0D
+=0D
+/*=0D
+ * code review modification:=0D<= br>+ * 1. $15 is deleted from reserved register set and add to tcg_target_r= eg_alloc_order[]=0D
+ * 2. $25 is deleted from tcg_target_reg_alloc_orde= r[]=0D
+ * 3. callee-clobbered register set bug fixed=0D
+ * 4. tcg_o= ut_ld/st bug fixed=0D
+ * 5. translation of INDEX_op_exit_tb bug fixed= =0D
+ * 6. translation of INDEX_op_goto_tb bug fixed=0D
+ * 7. tcg_out_brcond() bug fixed=0D
+= * 8. patch_reloc() rewritten=0D
+ * 9. qemu_ld/st() bug fixed=0D
+ *= 10. mul() ???=0D
+ * 11. be careful about register order, like tcg_out_= mov()=0D
+ * 12. remove INDEX_op_mov(i)_i32/i64 from tcg_out_op(), they = are already implemented in tcg.c=0D
+ * 13. icache flush not implemented= ???=0D
+*/=0D
+=0D
+#ifndef NDEBUG=0D
+static const char * con= st tcg_target_reg_names[TCG_TARGET_NB_REGS] =3D {=0D
+   = "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7",=0D
+    = "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",=0D
+  &n= bsp; "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",=0D
+ &= nbsp;  "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31",=0D
+= };=0D
+#endif=0D
+=0D
+/* =0D
+ * $26 ~ $31 are special, r= eserved, =0D
+ * and $25 is deliberately reserved for jcc operation= =0D
+ * and $0 is usually used for return function result, better allocate it later=0D
+ * and $15 is used= for cpu_env pointer, allocate it at last=0D
+*/=0D
+static const int= tcg_target_reg_alloc_order[] =3D {=0D
+    TCG_REG_1, TC= G_REG_2, TCG_REG_3, TCG_REG_4, TCG_REG_5, TCG_REG_6,=0D
+  &nb= sp; TCG_REG_7, TCG_REG_8, TCG_REG_22, TCG_REG_23, TCG_REG_24,=0D
+ =    TCG_REG_9, TCG_REG_10, TCG_REG_11, TCG_REG_12, TCG_REG_13, TCG= _REG_14,=0D
+    TCG_REG_16, TCG_REG_17, TCG_REG_18, TCG_= REG_19, TCG_REG_20, TCG_REG_21,=0D
+    TCG_REG_0, TCG_RE= G_15=0D
+};=0D
+=0D
+/*=0D
+ * according to alpha calling conve= ntion, these 6 registers are used for =0D
+ * function parameter pa= ssing. if function has more than 6 parameters, remained=0D
+ * ones are = stored on stack.=0D
+*/=0D
+static const int tcg_target_call_iarg_reg= s[6] =3D { =0D
+    TCG_REG_16, TCG_REG_17, TCG_REG_= 18, TCG_REG_19, TCG_REG_20, TCG_REG_21=0D
+    };=0D
+=0D
+/*=0D
+ * accord= ing to alpha calling convention, $0 is used for returning function result.= =0D
+*/=0D
+static const int tcg_target_call_oarg_regs[1] =3D { TCG_R= EG_0 };=0D
+=0D
+/*=0D
+ * save the address of TB's epilogue.=0D+*/=0D
+static uint8_t *tb_ret_addr;=0D
+=0D
+/* =0D
+ *= op-code and func-code for jump insn =0D
+*/=0D
+#define CONTROL= _CALL    0x01A=0D
+#define CONTROL_RET    =     0x01A=0D
+#define CONTROL_JMP     = ;   0x01A=0D
+=0D
+#define FUNC_JMP     = ;   0x00=0D
+#define FUNC_CALL      &= nbsp; 0x01=0D
+#define FUNC_RET        0x0= 2=0D
+=0D
+#define CONTROL_BR        0x= 30=0D
+#define CONTROL_BSR        0x34=0D<= br>+#define CONTROL_BEQ        0x39=0D
+#define CONTROL_BNE     = ;   0x3D=0D
+#define CONTROL_BLT      = ;  0x3A=0D
+#define CONTROL_BLE       = ; 0x3B=0D
+#define CONTROL_BGT        0x3F= =0D
+#define CONTROL_BGE        0x3E=0D+#define CONTROL_BLBC    0x38=0D
+#define CONTROL_BLBS&n= bsp;   0x3C=0D
+=0D
+#define ALPHA_ARITH    =     0x10=0D
+=0D
+#define ARITH_ADDL   =     0x00=0D
+#define ARITH_SUBL     =    0x09=0D
+#define ARITH_ADDQ      &= nbsp; 0x20=0D
+#define ARITH_SUBQ        0= x29=0D
+#define ARITH_CMPEQ        0x2D=0D=
+#define ARITH_CMPLT        0x4D=0D
+#= define ARITH_CMPLE        0x6D=0D
+#define ARITH= _CMPULT    0x1D=0D
+#define ARITH_CMPULE   = ; 0x3D=0D
+=0D
+#define ALPHA_MUL       = ; 0x13=0D
+=0D
+#define ARITH_MULL      &nbs= p; 0x00=0D
+#define ARITH_MULQ        0x20= =0D
+=0D
+#define ALPHA_LOGIC        0x= 11=0D
+=0D
+#define ARITH_AND        0x= 00=0D
+#define ARITH_BIC        0x08=0D+#define ARITH_BIS        0x20=0D
+#defin= e ARITH_ORNOT        0x28=0D
+#define ARIT= H_XOR        0x40=0D
+#define ARITH_EQV&nb= sp;       0x48=0D
+=0D
+#define ALPHA_SHIFT&= nbsp;       0x12=0D
+=0D
+#define ARITH_SLL&= nbsp;       0x39=0D
+#define ARITH_SRL     &= nbsp;  0x34=0D
+#define ARITH_SRA      &nb= sp; 0x3C=0D
+=0D
+#define ALPHA_SEXT      &n= bsp; 0x1C=0D
+=0D
+#define ARITH_SEXTB      =   0x00=0D
+#define ARITH_SEXTW       = 0x01=0D
+=0D
+#define ALPHA_LDA       = 0x08=0D
+#define ALPHA_LDAH        0x09= =0D
+#define ALPHA_LDBU        0x0A=0D
= +#define ALPHA_LDWU        0x0C=0D
+#defin= e ALPHA_LDL        0x28=0D
+#define ALPHA_= LDQ        0x29=0D
+#define ALPHA_STB = ;       0x0E=0D
+#define ALPHA_STW  &= nbsp;     0x0D=0D
+#define ALPHA_STL    &n= bsp;   0x2C =0D
+#define ALPHA_STQ        0x2D=0D
+= =0D
+/*=0D
+ * return the # of regs used for parameter passing on pro= cedure calling.=0D
+ * note that alpha use $16~$21 to transfer the first= 6 paramenters of a procedure.=0D
+*/=0D
+static inline int tcg_targe= t_get_call_iarg_regs_count(int flags)=0D
+{=0D
+    re= turn 6;=0D
+}=0D
+=0D
+/*=0D
+ * given constraint, return avail= able register set. this function is called once=0D
+ * for each op at qe= mu's initialization stage.=0D
+*/=0D
+static int target_parse_constra= int(TCGArgConstraint *ct, const char **pct_str)=0D
+{=0D
+  = ;  const char *ct_str =3D *pct_str;=0D
+=0D
+    = switch(ct_str[0]) =0D
+    {=0D
+  &nbs= p; case 'r':=0D
+        /* constaint 'r' = means any register is okay */=0D
+      &n= bsp; ct->ct |=3D TCG_CT_REG; =0D
+        tcg_regset_set32(ct->= u.regs, 0, 0xffffffff);=0D
+        b= reak;=0D
+=0D
+    case 'L':=0D
+   =     /* =0D
+        *= constranit 'L' is used for qemu_ld/st, which has 2 meanings:=0D
+ =        * 1st, we the argument need to be allocated= a register.=0D
+        * 2nd, we should = reserve some registers that belong to caller-clobbered =0D
+ &= nbsp;      * list for qemu_ld/st local usage, so these = registers must not be =0D
+        * = allocated to the argument that the 'L' constraint is describing.=0D
+&nb= sp;       *=0D
+      =   * note that op qemu_ld/st has the TCG_OPF_CALL_CLOBBER flag, and&nbs= p; =0D
+        * tcg will free all callee-cl= obbered registers before generate target=0D
+     &n= bsp;  * insn for qemu_ld/st, so we can use these register directly wit= hout=0D
+        * warrying about destroyi= ng their content.=0D
+        */=0D
+&n= bsp;       ct->ct |=3D TCG_CT_REG;=0D
+=         tcg_regset_set32(ct->u.regs, = 0, 0xffffffff);=0D
+        tcg_regse= t_reset_reg(ct->u.regs, TCG_REG_0);=0D
+     = ;   tcg_regset_reset_reg(ct->u.regs, TCG_REG_16);=0D
+ = ;       tcg_regset_reset_reg(ct->u.regs, T= CG_REG_17);=0D
+        tcg_regset_re= set_reg(ct->u.regs, TCG_REG_18);=0D
+     &n= bsp;  break; =0D
+=0D
+    default:=0D
+    =     return -1;=0D
+    }=0D
+=0D
+&n= bsp;   ct_str++;=0D
+    *pct_str =3D ct_str;= =0D
+    return 0;=0D
+}=0D
+=0D
+/*=0D
+ * w= hether op's input argument may use constant =0D
+*/=0D
+static i= nline int tcg_target_const_match( \=0D
+    tcg_target_lo= ng val, const TCGArgConstraint *arg_ct)=0D
+{=0D
+    = int ct;=0D
+    ct =3D arg_ct->ct;=0D
+  =   if (ct & TCG_CT_CONST)=0D
+     &nbs= p;  return 1;=0D
+    else=0D
+   =      return 0;=0D
+}=0D
+=0D
+/*=0D
+ * con= struct insn with following format. =0D
+ * (suitable for conditiona= l branch insn)=0D
+ *=0D
+ * 31      &n= bsp; 26 25    21 20            =             &nb= sp;   0=0D
+ * -----------------------------------------------= -------=0D
+ * |   OpCode  |   Ra   |=             &nb= sp; Disp           &= nbsp; |=0D
+ * ------------------------------------------------------=0D=
+*/=0D
+static inline void tcg_out_inst2(TCGContext *s, int Opcode, = int Ra, int Disp)=0D
+{=0D
+    uint32_t v;=0D
+&nb= sp;    
+    v =3D ( ( Opcode & 0x3f )= << 26  )=0D
+       | ( ( Ra & = 0x1f ) << 21 )=0D
+       | ( Disp & = 0x1fffff) ;=0D
+=0D
+    tcg_out32(s, v);  &= nbsp;  
+} =0D
+=0D
+/*=0D
+ * construct insn with following format. =0D=
+ * (used for ld/st or lda/ldah insn)=0D
+ *=0D
+ * 31  = ;      26 25    21 20  &n= bsp; 16 15           = ;        0=0D
+ * -------------------= -----------------------------------=0D
+ * |   OpCode  |&= nbsp;  Ra   |   Rb   |   =   Disp          &nbs= p;  |=0D
+ * ------------------------------------------------------= =0D
+*/=0D
+static inline void tcg_out_inst3_disp(TCGContext *s, int = Opcode, int Ra, int Rb, int Disp)=0D
+{=0D
+    uint32= _t v;=0D
+     
+    v =3D ( ( Opc= ode & 0x3f ) << 26  )=0D
+      = | ( ( Ra & 0x1f ) << 21 )=0D
+       | ( ( Rb & 0x1f )= << 16 )=0D
+       | ( Disp & 0xffff= ) ;=0D
+=0D
+    tcg_out32(s, v);    &n= bsp;
+}=0D
+=0D
+/*=0D
+ * construct insn with following format= . =0D
+ * (used for jmp insn)=0D
+ *=0D
+ * 31  &nb= sp;     26 25    21 20   = 16 15           &nb= sp;       0=0D
+ * -----------------------= -------------------------------=0D
+ * |   OpCode  | = ;  Ra   |   Rb   | Func |  &nb= sp; Rsvd       |=0D
+ * ------------------= ------------------------------------=0D
+*/=0D
+static inline void tc= g_out_inst3_func(TCGContext *s, int Opcode, int Ra, int Rb, int Func, int D= isp)=0D
+{ =0D
+    uint32_t v;=0D
+     
= +    v =3D ( ( Opcode & 0x3f ) << 26  )=0D+       | ( ( Ra & 0x1f ) << 21 )=0D+       | ( ( Rb & 0x1f ) << 16 )=0D+       | ( ( Func & 0x3 ) << 14 )=0D+       | ( Disp & 0x3fff) ;=0D
+=0D
+=     tcg_out32(s, v);     
+}=0D
+= =0D
+/*=0D
+ * construct insn with following format. =0D
+ * = (used for operate insn)=0D
+ *=0D
+ *      &= nbsp;               =                 = ;  1=0D
+ * 31        26 25 = ;   21 20    16 15 13 2 11    = 5 4   0=0D
+ * ------------------------------------------------------=0D
+ * | &n= bsp; OpCode  |   Ra   |   Rb  = | SBZ |0|  Func  | Rc  |=0D
+ * ------------------------= ------------------------------=0D
+*/=0D
+static inline void tcg_out_= inst4(TCGContext *s, int Opcode, int Ra, int Rb, int Func, int Rc)=0D
+{= =0D
+    uint32_t v;=0D
+=0D
+    v = =3D ( (Opcode & 0x3f) << 26  )=0D
+    &nb= sp;  | ( ( Ra & 0x1f ) << 21 )=0D
+    &nb= sp;  | ( ( Rb & 0x1f ) << 16 )=0D
+    &nb= sp;  | ( ( Func & 0x7f ) << 5 )=0D
+    &n= bsp;  | ( Rc & 0x1f ) ;=0D
+=0D
+    tcg_out3= 2(s, v);     
+}=0D
+=0D
+/*=0D
+ * constru= ct insn with following format. =0D
+ * (used for operate insn with = immediate)=0D
+ *=0D
+ *              &nbs= p;               &nb= sp;         1=0D
+ * 31   &= nbsp;    26 25    21 20   &nbs= p;      13 2 11     5 4 &= nbsp; 0=0D
+ * ------------------------------------------------------=0D=
+ * |   OpCode  |   Ra   | &nbs= p;   LIT      |1|  Func  | Rc&= nbsp; |=0D
+ * ------------------------------------------------------=0D=
+*/=0D
+static inline void tcg_out_inst4i(TCGContext *s, int Opcode,= int Ra, int Lit, int Func, int Rc)=0D
+{=0D
+    uint= 32_t v;=0D
+=0D
+    v =3D ( (Opcode & 0x3f) <&= lt; 26  )=0D
+       | ( ( Ra & 0x1f )= << 21 ) =0D
+       | ( ( Lit & 0xff ) << 13 = )=0D
+       | ( ( Func & 0x7f ) << 5= )=0D
+       | ( 1 << 12 )=0D
+ =       | ( Rc & 0x1f ) ;=0D
+=0D
+  =   tcg_out32(s, v);     
+}=0D
+=0D
+/*=0D=
+ * mov from a reg to another=0D
+*/=0D
+static inline void tcg_o= ut_mov(TCGContext *s, int Rc, int Rb)=0D
+{  =0D
+ &nb= sp;  if ( Rb !=3D Rc ) {=0D
+      &n= bsp; tcg_out_inst4(s, ALPHA_LOGIC, TCG_REG_31, Rb, ARITH_BIS, Rc); &nb= sp;      // bis $31, Rb, Rc=0D
+    }= =0D
+}=0D
+=0D
+/*=0D
+ * mov a 64-bit immediate 'arg' to regsi= ter 'Ra', this function will=0D
+ * generate fixed length (5 insns, 20 b= ytes) of target insn sequence.=0D
+*/=0D
+static inline void tcg_out_= movi_fixl( \=0D
+    TCGContext *s, TCGType type, int Ra, tcg_target_long arg)=0D
+{=0D
+=     if( arg & ((tcg_target_ulong)0x800000000000) )=0D+        tcg_out_inst3_disp(s, ALPHA_LDAH, R= a, TCG_REG_31, (arg>>48)+1 );=0D
+    else=0D
+&= nbsp;       tcg_out_inst3_disp(s, ALPHA_LDAH, Ra, = TCG_REG_31, arg>>48 );        // ldah R= a, arg<63:48>($31)=0D
+     =0D
+ &nbs= p;  if( arg & ((tcg_target_ulong)0x80000000) )=0D{
+  = ;      tcg_out_inst3_disp(s, ALPHA_LDA, Ra, Ra, (arg>= ;>32)+1 ); =0D
+    }
+    else= =0D
+        tcg_out_inst3_disp(s, ALPHA_L= DA, Ra, Ra, arg>>32 );         &nb= sp;          // lda Ra, arg<47:32>= (Ra) =0D
+     
+    tcg_out_inst4i(s, = ALPHA_SHIFT, Ra, 32, ARITH_SLL, Ra);        &= nbsp;           // sll Ra, 32, Ra= =0D
+     
+    if( arg & ((tc= g_target_ulong)0x8000) )=0D
+        tcg_o= ut_inst3_disp(s, ALPHA_LDAH, Ra, Ra, (arg>>16)+1 ); =0D
+&nbs= p;   else=0D
+        tcg_out_in= st3_disp(s, ALPHA_LDAH, Ra, Ra, arg>>16 );     &n= bsp;          // ldah Ra, arg<31:16&g= t;(Ra)=0D
+     
+    tcg_out_inst= 3_disp(s, ALPHA_LDA, Ra, Ra, arg );        &n= bsp;               &= nbsp;   // lda Ra, arg<15:0>(Ra)=0D
+}=0D
+=0D
+/*= =0D
+ * mov 64-bit immediate 'arg' to regsiter 'Ra'. this function will=0D
+ * gene= rate variable length of target insn sequence.=0D
+*/=0D
+static inlin= e void tcg_out_movi( \=0D
+    TCGContext *s, TCGType typ= e, int Ra, tcg_target_long arg)=0D
+{=0D
+    if (arg = =3D=3D 0) {=0D
+        tcg_out_inst4(s, A= LPHA_LOGIC, Ra, Ra, ARITH_XOR, Ra);        &n= bsp;       // xor Ra, Ra, Ra=0D
+  &n= bsp; }=0D
+    else if( arg =3D=3D (int16_t)arg ) {=0D+        tcg_out_inst3_disp(s, ALPHA_LDA, Ra= , TCG_REG_31, arg );           = ;     // lda Ra, arg<15:0>($31)=0D
+  &nb= sp; }=0D
+    else if( arg =3D=3D (int32_t)arg ) {=0D
= +        if( arg & (1<<15) ) {=0D+            tcg_out_inst3_disp(s, ALPHA_LDAH, Ra= , TCG_REG_31, (arg>>16)+1);=0D
+      &nb= sp; } else {=0D
+           = ; tcg_out_inst3_disp(s, ALPHA_LDAH, Ra, TCG_REG_31, arg>>16); &n= bsp;      // ldah Ra, arg<31:16>($31)=0D
+&nbs= p;       }=0D
+      &= nbsp; tcg_out_inst3_disp(s, ALPHA_LDA, Ra, Ra, arg );    &nb= sp;               &n= bsp;   // lda Ra, arg<15:0>(Ra)=0D
+    }= else {=0D
+        /* use the most comple= x style of movement */=0D
+        tcg_out= _movi_fixl(s, type, Ra, arg);=0D
+    }=0D
+}=0D
+= =0D
+/*=0D
+ * load value in disp(Rb) to Ra.=0D
+*/=0D
+static = inline void tcg_out_ld( \=0D
+    TCGContext *s, TCGType type, int R= a, int Rb, tcg_target_long disp)=0D
+{=0D
+    int Opc= ode;=0D
+    =0D
+    if( type =3D= =3D TCG_TYPE_I32) {=0D
+        Opcode =3D= ALPHA_LDL;=0D
+    } else {=0D
+    &n= bsp;   Opcode =3D ALPHA_LDQ;=0D
+    }=0D
+&= nbsp;    
+    if( disp !=3D (int16_t)disp= ) {=0D
+        /* disp cannot be stored = in insn directly */=0D
+        tcg_out_mo= vi(s, type, TMP_REG, disp);     
+   =     tcg_out_inst4(s, ALPHA_ARITH, Rb, TMP_REG, ARITH_ADDQ, = TMP_REG);        // addq Rb, TMP_REG, TMP_REG= =0D
+        tcg_out_inst3_disp(s, Opcode,= Ra, TMP_REG, 0);              &n= bsp;         // ldx Ra, 0(TMP_REG)=0D
+&nb= sp;   }=0D
+    else=0D
+    =     tcg_out_inst3_disp(s, Opcode, Ra, Rb, disp);  =                 = ;      // ldx Ra, disp(Rb)=0D
+}=0D
+=0D
+/*= =0D
+ * store value in Ra to disp(Rb).=0D
+*/=0D
+static inline vo= id tcg_out_st( \=0D
+    TCGContext *s, TCGType type, int= Ra, int Rb, tcg_target_long disp)=0D
+{=0D
+    int O= pcode;=0D
+=0D
+    if( type =3D=3D TCG_TYPE_I32) {=0D=
+        Opcode =3D ALPHA_STL;=0D
+&nb= sp;   } else {=0D
+        Opcod= e =3D ALPHA_STQ;=0D
+    }=0D
+=0D
+  &nb= sp; if( disp !=3D (int16_t)disp ) { =0D
+        /* disp cannot be stored in i= nsn directly */=0D
+        tcg_out_movi(s= , type, TMP_REG, disp);=0D
+        tcg_ou= t_inst4(s, ALPHA_ARITH, Rb, TMP_REG, ARITH_ADDQ, TMP_REG);   = ; // addq Rb, TMP_REG, TMP_REG=0D
+       = tcg_out_inst3_disp(s, Opcode, Ra, TMP_REG, 0);     &nb= sp;               &n= bsp;  // stx Ra, 0(TMP_REG)=0D
+    }=0D
+ &= nbsp;  else=0D
+        tcg_out_inst3= _disp(s, Opcode, Ra, Rb, disp);         =                // st= x Ra, disp(Rb)=0D
+}=0D
+=0D
+/*=0D
+ * generate arithmatic ins= truction with immediate. Ra is used as both=0D
+ * input and output, and= val is used as another input.=0D
+*/=0D
+static inline void tgen_arithi( \=0D
+&= nbsp;   TCGContext *s, int Opcode, int Func, int Ra, tcg_target_l= ong val)=0D
+{=0D
+    if (val =3D=3D (uint8_t)val) {= =0D
+        tcg_out_inst4i(s, Opcode, Ra,= val, Func, Ra);            &n= bsp;           // arithi Ra, #b, Ra= =0D
+    } else {=0D
+      &= nbsp; tcg_out_movi(s, TCG_TYPE_I64, TMP_REG, val);=0D
+   = ;     tcg_out_inst4(s, Opcode, Ra, TMP_REG, Func, Ra); =                 = ;   // arithi Ra, TMP_REG, Ra=0D
+    }=0D
+= }=0D
+=0D
+/*=0D
+ * generate addq instruction with immediate.=0D<= br>+*/=0D
+static void tcg_out_addi(TCGContext *s, int reg, tcg_target_l= ong val)=0D
+{ =0D
+    if (val !=3D 0)=0D
+    &= nbsp;   tgen_arithi(s, ALPHA_ARITH, ARITH_ADDQ, reg, val);=0D
= +}=0D
+=0D
+/*=0D
+ * generate insn to push reg onto stack.=0D
= +*/=0D
+static inline void tcg_out_push(TCGContext *s, int reg)=0D
+{= =0D
+    tcg_out_inst4i(s, ALPHA_ARITH, TCG_REG_30, 8, AR= ITH_SUBQ, TCG_REG_30);=0D
+    tcg_out_inst3_disp(s, ALPH= A_STQ, reg, TCG_REG_30, 0);=0D
+}=0D
+=0D
+/*=0D
+ * generate i= nsn to pop value from stack to reg.=0D
+*/=0D
+static inline void tcg= _out_pop(TCGContext *s, int reg)=0D
+{=0D
+    tcg_out= _inst3_disp(s, ALPHA_LDQ, reg, TCG_REG_30, 0);=0D
+    tc= g_out_inst4i(s, ALPHA_ARITH, TCG_REG_30, 8, ARITH_ADDQ, TCG_REG_30);=0D
= +}=0D
+=0D
+static const uint8_t tcg_cond_to_jcc[10] =3D {=0D
+&nb= sp;   [TCG_COND_EQ] =3D ARITH_CMPEQ,=0D
+    [T= CG_COND_NE] =3D ARITH_CMPEQ, =0D
+    [TCG_COND_LT] =3D ARITH_CMPLT,=0D
+ &nbs= p;  [TCG_COND_GE] =3D ARITH_CMPLT,=0D
+    [TCG_COND= _LE] =3D ARITH_CMPLE,=0D
+    [TCG_COND_GT] =3D ARITH_CMP= LE,=0D
+    [TCG_COND_LTU] =3D ARITH_CMPULT,=0D
+ = ;   [TCG_COND_GEU] =3D ARITH_CMPULT,=0D
+    [T= CG_COND_LEU] =3D ARITH_CMPULE,=0D
+    [TCG_COND_GTU] =3D= ARITH_CMPULE=0D
+};=0D
+=0D
+/*=0D
+ * called by tcg_out_reloc= () when the label address is determined, =0D
+ * i.e., label->ha= s_value is true. what should be done is to patch =0D
+ * the jmp in= sn that reference this label.=0D
+ *=0D
+ * code_ptr - position need = to patch=0D
+ * type - relocation type=0D
+ * value - label address= =0D
+ * addend - not used=0D
+*/=0D
+static void patch_reloc(uint8= _t *code_ptr, \=0D
+    int type, tcg_target_long value, = tcg_target_long addend)=0D
+{=0D
+    TCGContext s;=0D
+     
+    if (= type !=3D R_ALPHA_REFQUAD)=0D
+        tc= g_abort();=0D
+     
+    s.code_p= tr =3D code_ptr;=0D
+    tcg_out_movi_fixl(&s, TCG_TY= PE_I64, TMP_REG, value);=0D
+    tcg_out_inst3_func(&= s, CONTROL_JMP, TCG_REG_31, TMP_REG, FUNC_JMP, 0);=0D
+}=0D
+=0D
+= /*=0D
+ * generate insns for BR or BRCOND =0D
+ * opc must be CO= NTROL_BR or CONTROL_BLBC or CONTROL_BLBS=0D
+ * Ra fixed to TMP_REG=0D+*/=0D
+static void tcg_out_jxx(TCGContext *s, int opc, int Ra, int la= bel_index)=0D
+{=0D
+    tcg_target_long val;=0D
+&= nbsp;   TCGLabel *l =3D &s->labels[label_index];=0D
+&n= bsp;   =0D
+    if ((Ra !=3D TMP_REG) ||= =0D
+        (opc !=3D CONTROL_BR &&am= p; opc !=3D CONTROL_BLBC && opc !=3D CONTROL_BLBS) )=0D
+        tcg_abort();= =0D
+=0D
+    if (l->has_value) {=0D
+ &nbs= p;      /* the label address has been resolved. */=0D+        val =3D (l->u.value - (tcg_targ= et_long)s->code_ptr - 4) >> 2;=0D
+     &nb= sp;  if ( val >=3D -0x100000 && val < 0x100000) { &= nbsp;      =0D
+     &= nbsp;      /* if distance can be put into 21-bit field = */=0D
+            tcg_out_= inst2(s, opc, Ra, val);=0D
+        } else= {=0D
+            /* dista= nce can't be put into 21-bit field */=0D
+      = ;      if ( opc !=3D CONTROL_BR) {=0D
+  &= nbsp;             tcg_out_inst2(s, opc^4, Ra, 6); = ;=0D
+            }=0D
+= =0D
+            tcg_out_mo= vi_fixl(s, TCG_TYPE_I64, Ra, l->u.value);=0D
+    &nbs= p;       tcg_out_inst3_func(s, CONTROL_JMP, TCG_RE= G_31, Ra, FUNC_JMP, 0);    // jmp $31, TMP_REG, 0 =0D+        }=0D
+    } else= { =0D
+        /* =0D
+ = ;        * if the label addr has not been det= ermined, we first insert a short jmp,=0D
+      = ;   * and then resv space (6 insns, 24 bytes) for long jmp = =0D
+        */=0D
+    =     if ( opc !=3D CONTROL_BR) {=0D
+    &n= bsp;       tcg_out_inst2(s, opc^4, Ra, 6); =0D
+ &nbs= p;      }=0D
+=0D
+      = ;  /* record relocation infor */=0D
+      = ;  tcg_out_reloc(s, s->code_ptr, R_ALPHA_REFQUAD, label_index, 0);= =0D
+        s->code_ptr +=3D 24;=0D+    }=0D
+}=0D
+=0D
+/*=0D
+ * generate insn f= or INDEX_op_brcond=0D
+*/=0D
+static void tcg_out_brcond( TCGContext = *s, int cond, \=0D
+    TCGArg arg1, TCGArg arg2, int con= st_arg2, int label_index)=0D
+{=0D
+    int Func, jcc_= opc;=0D
+=0D
+    if ( cond < TCG_COND_EQ || cond &= gt; TCG_COND_GTU)=0D
+        tcg_abort();= =0D
+=0D
+    /* get function code according to condit= ion */=0D
+    Func =3D tcg_cond_to_jcc[cond];=0D
+&nb= sp;    
+    if ( const_arg2) {=0D
+   =     tcg_out_movi(s, TCG_TYPE_I64, TMP_REG, arg2);=0D
+&n= bsp;       tcg_out_inst4(s, ALPHA_ARITH, arg1, TMP= _REG, Func, TMP_REG);    // CMPxx arg1, TMP_REG, TMP_REG=0D<= br>+    } else {=0D
+       = ; tcg_out_inst4(s, ALPHA_ARITH, arg1, arg2, Func, TMP_REG);  &nbs= p;     // CMPxx arg1, arg2, TMP_REG=0D
+   = ; }=0D
+=0D
+    //=0D
+    // -----= ----------------------------=0D
+    //  cond & = 1  |  TMP_REG  |  take?=0D
+    // --= -------------------------------=0D
+    //  &nb= sp;   0     |     0 =     |   not=0D
+    //      0     |  &n= bsp;  1     |   yes=0D
+  &= nbsp; //      1     | &nb= sp;   0     |   yes=0D
+ &n= bsp;  //      1     |&nbs= p;    1     |   not=0D
+&nb= sp;   // ---------------------------------=0D
+  &nb= sp; //=0D
+    jcc_opc =3D (cond & 1) ? CONTROL_BLBC = : CONTROL_BLBS;=0D
+    tcg_out_jxx(s, jcc_opc, TMP_REG, = label_index);     
+}=0D
+=0D
+=0D
+#if def= ined(CONFIG_SOFTMMU)=0D
+=0D
+#include "../../softmmu_defs.h"=0D
+= =0D
+static void *qemu_ld_helpers[4] =3D {=0D
+    __l= db_mmu,=0D
+    __ldw_mmu,=0D
+    __ld= l_mmu, =0D
+    __ldq_mmu,=0D
+};=0D
+=0D
+static void = *qemu_st_helpers[4] =3D {=0D
+    __stb_mmu,=0D
+ = ;   __stw_mmu,=0D
+    __stl_mmu,=0D
+ =    __stq_mmu,=0D
+};=0D
+=0D
+#endif=0D
+=0D
+/*&n= bsp;=0D
+ * XXX: qemu_ld and qemu_st could be modified to clobber only E= DX and=0D
+ * EAX. It will be useful once fixed registers globals are le= ss common. =0D
+ *=0D
+ * output host insn for op 'qemu_ldxx t0,= t1, flags', which means fetching value from t1 to t0.=0D
+ * flags give= s the current CPU mode, kernel or user.=0D
+ *=0D
+ * opc argument de= termines the data width and extension type (zero or signed), and has the&nb= sp;=0D
+ * following layout:=0D
+ *     &nbs= p;            &= nbsp;         2  1  0=0D<= br>+ * ------------------------------------=0D
+ * |    &n= bsp;            = ;       | E |  W  |=0D
+ * -----= -------------------------------=0D
+ *=0D
+ * E =3D 0 means zero exte= ntion, 1 means signed extension=0D
+ * W =3D 0 means byte, 1 means word,= 2 means dword.=0D
+ *=0D
+ * Note that VM addr space may be 32-bit o= r 64-bit, below, we take 32-bit addr space as example=0D
+ * when doing = the comment.=0D
+*/=0D
+static void tcg_out_qemu_ld(TCGContext *s, co= nst TCGArg *args, int opc)=0D
+{=0D
+    int addr_reg,= data_reg, r0, r1, mem_index, s_bits, bswap;=0D
+=0D
+#if defined(CON= FIG_SOFTMMU)=0D
+    uint8_t *label1_ptr, *label2_ptr;=0D=
+#endif=0D
+=0D
+    data_reg =3D *args++;=0D
+=     addr_reg =3D *args++;=0D
+    mem_inde= x =3D *args;=0D
+    s_bits =3D opc & 3;=0D
+=0D
+    r0 =3D TCG_REG_16;=0D+    r1 =3D TCG_REG_17;=0D
+=0D
+#if defined(CONFIG_= SOFTMMU)=0D
+=0D
+    tcg_out_mov(s, r1, addr_reg);&nb= sp;=0D
+    tcg_out_mov(s, r0, addr_reg); =0D
+&n= bsp;=0D
+#if TARGET_LONG_BITS =3D=3D 32=0D
+    /* if = VM is of 32-bit arch, clear higher 32-bit of addr */=0D
+  &nb= sp; tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SLL, r0);   = ;               &nbs= p;             // sll r0, 32, = r0=0D
+    tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_S= RL, r0);             &nbs= p;               &nb= sp;  // srl r0, 32, r0=0D
+    tcg_out_inst4i(s, ALP= HA_SHIFT, r1, 32, ARITH_SLL, r1);              &= nbsp;               =   // sll r0, 32, r0=0D
+    tcg_out_inst4i(s, ALPHA_= SHIFT, r1, 32, ARITH_SRL, r1);         &= nbsp;               =        // srl r0, 32, r0=0D
+#endif=0D
+=0D<= br>+    tgen_arithi(s, ALPHA_LOGIC, ARITH_AND, r0, TARGET_PA= GE_MASK | ((1 << s_bits) - 1));    // and r0, #b, r0&n= bsp;=0D
+=0D
+    //=0D
+    // afte= r above insn, we got the page # stored in r0.  note that if VM addr sp= ace is 32 bits,=0D
+    // then the higher 32 bits of r0 = should be 0=0D
+    //=0D
+    // =      32 31            =              12= 11            =      1 0=0D
+    // -----------------= --------------------------------------------=0D
+    //&n= bsp; ...00 |          &nb= sp;  page#          = |    ...0000...     |xx|=0D
+ &= nbsp;  // ------------------------------------------------------------= -=0D
+    //=0D
+=0D
+    // = =0D
+    // the following 2 host insns are tricky. note t= hat TLB has 256 entries,=0D
+    // and entry is (1<&l= t;CPU_TLB_ENTRY_BITS) bytes aligned. to check=0D
+    // = whether an address is cached in TLB, we may (1) get the page# =0D
+ &nbs= p;  // from the address; (2) mask page# by 0xff, i.e., the simplest ha= sh=0D
+    // algorithm, to get TLB entry index; (3) shif= t the result CPU_TLB_ENTRY_BITS=0D
+    // bits left to g= et the entry offset in TLB; (4) compare page# calculated=0D
+  = ;  // in step (1) with the page# stored in TLB entry, if match, we can= tell=0D
+    // that the address is cached. take i386 as= example, the CPU_TLB_ENTRY_BITS=0D
+    // is 4, TARGET_= PAGE_BITS is 12, so the original address has the folloing=0D
+ &nbs= p;  // layout.=0D
+    //=0D
+    = //      32 31      &= nbsp;           &nbs= p;      12 11            4&nbs= p; 3   0=0D
+    // ---------------------------= ----------------------------------=0D
+    //  ...00= |             = page#           | &n= bsp;            = ;  |     |=0D
+    // ----------= ---------------------------------------------------=0D
+  &nbs= p; //=0D
+=0D
+    tgen_arithi(s, ALPHA_SHIFT, ARITH_S= RL, r1, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS);    // srl r1= , #b, r1=0D
+=0D
+    //=0D
+    // = after above insn, the addres has following layout:=0D
+   = ; //=0D
+    //      32 31            =             &nb= sp; 12  11          4&nbs= p; 3   0=0D
+    // ---------------------------= ----------------------------------=0D
+    //  ...00= |     0000...  |     &nb= sp;      page#      =         |     |=0D+    // --------------------------------------------------= -----------=0D
+    //=0D
+    =0D=
+    tgen_arithi(s, ALPHA_LOGIC, ARITH_AND, r1, (CPU_TLB= _SIZE-1) << CPU_TLB_ENTRY_BITS);    // and r1, #b, r1= =0D
+=0D
+    // after above insn, the addres has foll= owing layout:=0D
+    //=0D
+    // &nb= sp;    32 31        =             &nb= sp;   12  11        =     4  3    0=0D
+    = // --------------------------------------------------------------=0D
+&n= bsp;   //  ...00 |       =      00000       &nb= sp;   |   page# & 0xff  | 0000 |=0D
+ =    // -----------------------------------------------------------= ---=0D
+    //         = ;               &nbs= p;              |<-  TLB entry offset  ->|=0D
+    //=0D=
+=0D
+    tcg_out_addi(s, r1, offsetof(CPUState, tlb_= table[mem_index][0].addr_read));         = ;   // addq r1, offset, r1=0D
+    tcg_out_inst= 4(s, ALPHA_ARITH, r1, TCG_REG_15, ARITH_ADDQ, r1);     =                 = ;   // addq r1, $15, r1=0D
+#if TARGET_LONG_BITS =3D=3D 32=0D<= br>+    tcg_out_inst3_disp(s, ALPHA_LDL, TMP_REG, r1, 0);&nb= sp;               &n= bsp;               &= nbsp;   // ldl TMP_REG, 0(r1)=0D
+    tcg_out_i= nst4i(s, ALPHA_SHIFT, TMP_REG, 32, ARITH_SLL, TMP_REG);    &= nbsp;               = // sll TMP_REG, 32, TMP_REG=0D
+    tcg_out_inst4i(s, ALPHA_SHI= FT, TMP_REG, 32, ARITH_SRL, TMP_REG);        =             // srl TMP_REG, 32= , TMP_REG=0D
+#else=0D
+    tcg_out_inst3_disp(s, ALPH= A_LDQ, TMP_REG, r1, 0);          &n= bsp;               &= nbsp;         // ldq TMP_REG, 0(r1)=0D
+#e= ndif=0D
+         
+  &n= bsp; //=0D
+    // now, r0 contains the page# and TMP_REG= contains the addr to tlb_entry.addr_read=0D
+    // we b= elow will compare them=0D
+    //=0D
+  &nbs= p; tcg_out_inst4(s, ALPHA_ARITH, TMP_REG, r0, ARITH_CMPEQ, TMP_REG); &= nbsp;                  // cmpeq TMP_REG, r0, TMP_REG=0D
+=0D
+ &nbs= p;  tcg_out_mov(s, r0, addr_reg); =0D
+#if TARGET_LONG_BITS = =3D=3D 32=0D
+    tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, = ARITH_SLL, r0);            &nb= sp;               &n= bsp;   // sll r0, 32, r0=0D
+    tcg_out_inst4i= (s, ALPHA_SHIFT, r0, 32, ARITH_SRL, r0);      &nbs= p;               &nb= sp;         // srl r0, 32, r0=0D
+#endif= =0D
+=0D
+    //=0D
+    // if equal= , we jump to label1. since label1 is not resolved yet, =0D
+ &= nbsp;  // we just record a relocation.=0D
+    //=0D=
+    label1_ptr =3D s->code_ptr;=0D
+  &= nbsp; s->code_ptr +=3D 4; =0D
+=0D
+    //=0D
+    // here, un= equal, TLB-miss.=0D
+    //=0D
+    tcg= _out_movi(s, TCG_TYPE_I32, TCG_REG_17, mem_index);     =                 = ;       // pass argument 2=0D
+  &nbs= p; tcg_out_movi(s, TCG_TYPE_I64, \=0D
+      &n= bsp; TMP_REG, (tcg_target_long)qemu_ld_helpers[s_bits]);    =                =             // get helper fun= c entry=0D
+    tcg_out_push(s, TCG_REG_26);=0D
+tcg_o= ut_mov(s, TCG_REG_27, TMP_REG);
+    tcg_out_inst3_func(s= , CONTROL_CALL, TCG_REG_26, TMP_REG, FUNC_CALL, 0);     = ;           // call helper func =0D
+    tcg_out_pop(s, TCG_REG_26);=0D
+  &= nbsp;  
+    //=0D
+    // after h= elper function call, the result of ld is saved in $0=0D
+  &nb= sp; //=0D
+    switch(opc) {=0D
+    ca= se 0 | 4:=0D
+        tcg_out_inst4(s= , ALPHA_SEXT, TCG_REG_31, TCG_REG_0, ARITH_SEXTB, data_reg);  &nb= sp;     // sextb $31, $0, data_reg=0D
+   =      break;=0D
+    case 1 | 4:=0D+        tcg_out_inst4(s, ALPHA_SEXT, T= CG_REG_31, TCG_REG_0, ARITH_SEXTW, data_reg);      = ;  // sextw $31, $0, data_reg=0D
+     &nb= sp;  break;=0D
+    case 2 | 4:=0D
+  &= nbsp;     tcg_out_inst4i(s, ALPHA_SHIFT, TCG_REG_0, 32,= ARITH_SLL, TCG_REG_0);            // sll= $0, 32, $0=0D
+        tcg_out_inst4i(s, = ALPHA_SHIFT, TCG_REG_0, 32, ARITH_SRA, data_reg);     &= nbsp;          // sra $0, 32, data_reg= =0D
+        break;=0D
+ &nbs= p;  case 0:=0D
+        tcg_out_= inst4i(s, ALPHA_SHIFT, TCG_REG_0, 56, ARITH_SLL, TCG_REG_0);  &nb= sp;         // sll $0, 56, $0=0D
+ &n= bsp;      tcg_out_inst4i(s, ALPHA_SHIFT, TCG_REG_0, 56,= ARITH_SRL, data_reg);          &nb= sp;     // srl $0, 56, data_reg=0D
+    &n= bsp;   break;=0D
+    case 1:=0D
+ &nbs= p;      tcg_out_inst4i(s, ALPHA_SHIFT, TCG_REG_0, = 48, ARITH_SLL, TCG_REG_0);          &n= bsp; // sll $0, 48, $0=0D
+        tcg_out= _inst4i(s, ALPHA_SHIFT, TCG_REG_0, 48, ARITH_SRL, data_reg);  &nb= sp;             // srl $0, 48,= data_reg=0D
+        break;=0D
+ =    case 2:=0D
+    default:=0D
+  =       tcg_out_inst4i(s, ALPHA_SHIFT, TCG_REG_0, 32= , ARITH_SLL, TCG_REG_0);          &= nbsp; // sll $0, 32, $0=0D
+        tcg_ou= t_inst4i(s, ALPHA_SHIFT, TCG_REG_0, 32, ARITH_SRL, data_reg);  &n= bsp;             // srl $0, 32= , data_reg=0D
+        break;=0D
+ = ;   case 3:=0D
+        tcg_out_= mov(s, data_reg, TCG_REG_0);=0D
+        br= eak;=0D
+    }=0D
+=0D
+    //=0D+    // we have done, jmp to label2. label2 is not resolved= yet, =0D
+    // we record a relocation.=0D
+&nb= sp;   //=0D
+    label2_ptr =3D s->code_ptr;= =0D
+    s->code_ptr +=3D 4;=0D
+   =  =0D
+    // patch jmp to label1=0D
+  =   *(uint32_t *)label1_ptr =3D (uint32_t) \=0D
+    &= nbsp;   ( ( CONTROL_BNE << 26 ) | ( TMP_REG << 21 ) \= =0D
+        | ( ((s->code_ptr-label1_p= tr-4)>>2) & 0x1fffff) );        &nb= sp;               &n= bsp;       // beq TMP_REG, disp =0D
+=0D+    // =0D
+    // if we get here, a TLB entry is hit, r0 contai= ns the guest addr and =0D
+    // r1 contains the pt= r that point to tlb_entry.addr_read. what we should=0D
+  &nbs= p; // do is to load the tlb_entry.addend (64-bit on alpha) and add it to&nb= sp;=0D
+    // r0 to get the host VA=0D
+  &= nbsp; //=0D
+    tcg_out_movi(s, TCG_TYPE_I64, TMP_REG, \= =0D
+        offsetof(CPUTLBEntry, addend)= - offsetof(CPUTLBEntry, addr_read));        =         // TMP_REG <- distance btw addent = and addr_read=0D
+    tcg_out_inst4(s, ALPHA_ARITH, r1, T= MP_REG, ARITH_ADDQ, r1);          &= nbsp;               =   // addq r1, TMP_REG, r1=0D
+    tcg_out_inst3_disp= (s, ALPHA_LDQ, TMP_REG, r1,  0);        &nb= sp;               &n= bsp;           // ldq TMP_REG, r1, = 0=0D
+    tcg_out_inst4(s, ALPHA_ARITH, r0, TMP_REG, ARIT= H_ADDQ, r0);             =                // ad= dq r0, TMP_REG, r0=0D
+     
+#else=0D
+ =    r0 =3D addr_reg;=0D
+#endif // endif defined(CONFIG_SOFTMMU= )=0D
+=0D
+=0D
+#ifdef TARGET_WORDS_BIGENDIAN=0D
+  &= nbsp; bswap =3D 1;=0D
+#else=0D
+    bswap =3D 0;=0D+#endif=0D
+=0D
+    if ( bswap) {=0D
+ &nbs= p;      tcg_abort();=0D
+    }=0D
= +=0D
+    //=0D
+    // when we get her= e, r0 contains the host VA that can be used to access guest PA=0D
+    //=0D
+  = ;  switch(opc) {=0D
+    case 0:=0D
+  =       tcg_out_inst3_disp(s, ALPHA_LDBU, data_reg, = r0, 0);              = ;               &nbs= p;  // ldbu data_reg, 0(r0)=0D
+      = ;  break;=0D
+    case 0 | 4:=0D
+  &nb= sp;     tcg_out_inst3_disp(s, ALPHA_LDBU, data_reg, r0,= 0);              &n= bsp;               &= nbsp; // ldbu data_reg, 0(r0)=0D
+        = tcg_out_inst4(s, ALPHA_SEXT, TCG_REG_31, data_reg, ARITH_SEXTB, data_reg);&= nbsp;       // sextb $31, data_reg, data_reg =0D
+        break;=0D
+ &nbs= p;  case 1:=0D
+        tcg_out_= inst3_disp(s, ALPHA_LDWU, data_reg, r0, 0);      &= nbsp;               =           // ldwu data_reg, 0(r0)=0D
= +        break;=0D
+   = ; case 1 | 4:=0D
+        tcg_out_ins= t3_disp(s, ALPHA_LDWU, data_reg, r0, 0);      &nbs= p;               &nb= sp;         // ldwu data_reg, 0(r0)=0D
+&n= bsp;       tcg_out_inst4(s, ALPHA_SEXT, TCG_REG_31= , data_reg, ARITH_SEXTW, data_reg);        //= sextw $31, data_reg, data_reg=0D
+      &= nbsp; break;=0D
+    case 2:=0D
+    &n= bsp;   tcg_out_inst3_disp(s, ALPHA_LDL, data_reg, r0, 0); &n= bsp;               &= nbsp;              // ldl= data_reg, 0(r0)=0D
+        tcg_out_inst4= i(s, ALPHA_SHIFT, data_reg, 32, ARITH_SLL, data_reg);    &nb= sp;           // sll data_reg, 32, = data_reg=0D
+        tcg_out_inst4i(s, ALP= HA_SHIFT, data_reg, 32, ARITH_SRL, data_reg);      = ;          // srl data_reg, 32, data_reg= =0D
+        break;=0D
+ &nbs= p;  case 2 | 4:=0D
+        tcg_= out_inst3_disp(s, ALPHA_LDL, data_reg, r0, 0);                   = ;             // ldl data_reg,= 0(r0)=0D
+        break;=0D
+&nbs= p;   case 3:=0D
+        tc= g_out_inst3_disp(s, ALPHA_LDQ, data_reg, r0, 0);     &n= bsp;               &= nbsp;          // ldq data_reg, 0(r0)=0D=
+        break;=0D
+  &= nbsp; default:=0D
+        tcg_abort(= );=0D
+    }=0D
+=0D
+#if defined(CONFIG_SOFTMMU)= =0D
+    /* label2: */=0D
+    *(uint32= _t *)label2_ptr =3D (uint32_t)( ( CONTROL_BR << 26 ) \=0D
+ &= nbsp;             | ( TCG_REG_= 31  << 21 ) | =0D
+            =    ( ((s->code_ptr-label2_ptr-4)>>2) & 0x1fffff) );= =0D
+#endif=0D
+}=0D
+=0D
+static void tcg_out_qemu_st(TCGConte= xt *s, const TCGArg *args, int opc)=0D
+{=0D
+    int = addr_reg, data_reg, r0, r1, mem_index, s_bits, bswap;=0D
+#if defined(CO= NFIG_SOFTMMU)=0D
+    uint8_t *label1_ptr, *label2_ptr;= =0D
+#endif=0D
+=0D
+    data_reg =3D *args++;=0D+    addr_reg =3D *args++;=0D
+    mem_i= ndex =3D *args;=0D
+    s_bits =3D opc&3;=0D
+=0D<= br>+    r0 =3D TCG_REG_16;=0D
+    r1 =3D = TCG_REG_17;=0D
+=0D
+#if defined(CONFIG_SOFTMMU)=0D
+=0D
+ = ;   tcg_out_mov(s, r1, addr_reg); =0D
+   = tcg_out_mov(s, r0, addr_reg); =0D
+ =0D
+#if TARGET_LONG_B= ITS =3D=3D 32=0D
+    /* if VM is of 32-bit arch, clear higher 32-bit of addr */=0D
+    tcg_out_ins= t4i(s, ALPHA_SHIFT, r0, 32, ARITH_SLL, r0);      &= nbsp;               =           // sll r0, 32, r0=0D
+ = ;   tcg_out_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SRL, r0); &= nbsp;               =                // sr= l r0, 32, r0=0D
+    tcg_out_inst4i(s, ALPHA_SHIFT, r1, 3= 2, ARITH_SLL, r1);            =                =     // sll r0, 32, r0=0D
+    tcg_out_ins= t4i(s, ALPHA_SHIFT, r1, 32, ARITH_SRL, r1);      &= nbsp;                         // srl r0, 32, r0= =0D
+#endif=0D
+=0D
+    tgen_arithi(s, ALPHA_LOGIC= , ARITH_AND, r0, TARGET_PAGE_MASK | ((1 << s_bits) - 1));  =   // and r0, #b, r0=0D
+=0D
+    tgen_arithi(s, A= LPHA_SHIFT, ARITH_SRL, r1, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); &nb= sp;  // srl r1, #b, r1    =0D
+  &nbs= p; tgen_arithi(s, ALPHA_LOGIC, ARITH_AND, r1, (CPU_TLB_SIZE-1) << CPU= _TLB_ENTRY_BITS);    // and r1, #b, r1=0D
+=0D
+ =    tcg_out_addi(s, r1, offsetof(CPUState, tlb_table[mem_index][0]= .addr_write));        // addq r1, offset, r1= =0D
+    tcg_out_inst4(s, ALPHA_ARITH, r1, TCG_REG_15, AR= ITH_ADDQ, r1);            &nbs= p;           // addq r1, $15, r1=0D=
+=0D
+#if TARGET_LONG_BITS =3D=3D 32=0D
+    tcg_out_inst3_disp(s,= ALPHA_LDL, TMP_REG, r1, 0);         &nb= sp;               &n= bsp;          // ldl TMP_REG, 0(r1)=0D+    tcg_out_inst4i(s, ALPHA_SHIFT, TMP_REG, 32, ARITH_SLL= , TMP_REG);             &= nbsp;      // sll TMP_REG, 32, TMP_REG=0D
+ &nb= sp;  tcg_out_inst4i(s, ALPHA_SHIFT, TMP_REG, 32, ARITH_SRL, TMP_REG);&= nbsp;               =     // srl TMP_REG, 32, TMP_REG=0D
+#else=0D
+ &n= bsp;  tcg_out_inst3_disp(s, ALPHA_LDQ, TMP_REG, r1, 0);  &nb= sp;               &n= bsp;               &= nbsp; // ldq TMP_REG, 0(r1)=0D
+#endif=0D
+=0D
+    //= =0D
+    // now, r0 contains the page# and TMP_REG contai= ns the addr to tlb_entry.addr_read=0D
+    // we below wi= ll compare them=0D
+    //    =0D
= +    tcg_out_inst4(s, ALPHA_ARITH, TMP_REG, r0, ARITH_CMPEQ,= TMP_REG);             &n= bsp;      // cmpeq TMP_REG, r0, TMP_REG=0D
+=0D
+=     tcg_out_mov(s, r0, addr_reg); =0D
+#if TARGET_LO= NG_BITS =3D=3D 32=0D
+    tcg_out_inst4i(s, ALPHA_SHIFT, = r0, 32, ARITH_SLL, r0);          &n= bsp;               &= nbsp;     // sll r0, 32, r0=0D
+    tcg_ou= t_inst4i(s, ALPHA_SHIFT, r0, 32, ARITH_SRL, r0);     &n= bsp;                 = ;         // srl r0, 32, r0=0D
+#endif=0D<= br>+=0D
+    //=0D
+    // if equal, we= jump to label1. since label1 is not resolved yet, =0D
+  = ;  // we just record a relocation.=0D
+    //=0D
= +    label1_ptr =3D s->code_ptr;=0D
+   = ; s->code_ptr +=3D 4;=0D
+=0D
+    // here, unequal= , TLB-miss, ...=0D
+    tcg_out_mov(s, TCG_REG_17, data_r= eg);              &n= bsp;               &= nbsp;               =   // pass argument 2=0D
+    tcg_out_movi(s, TCG_TYP= E_I32, TCG_REG_18, mem_index);         &= nbsp;                 = ; // pass argument 3=0D
+    tcg_out_movi(s, TCG_TYPE_I64= , \=0D
+        TMP_REG, (tcg_target_long)= qemu_st_helpers[s_bits]);          =                 = ;      // get helper func entry=0D
+  &nbs= p; tcg_out_push(s, TCG_REG_26);=0D
+tcg_out_mov(s, TCG_REG_27,TMP_REG);<= br>+    tcg_out_inst3_func(s, CONTROL_CALL, TCG_REG_26, TMP_= REG, FUNC_CALL, 0);           =     // call helper func=0D
+    tcg_out_p= op(s, TCG_REG_26);=0D
+=0D
+    //=0D
+  =   // we have done, jmp to label2. label2 is not resolved yet, =0D=
+    // we record a relocation.=0D
+   = ; // =0D
+    label2_ptr =3D s->code_ptr;=0D
+ &nbs= p;  s->code_ptr +=3D 4;=0D
+    =0D
+&nbs= p;   // patch jmp to label1=0D
+    *(uint32_t = *)label1_ptr =3D (uint32_t) \=0D
+        = ( ( CONTROL_BNE << 26) | ( TMP_REG  << 21 )=0D
+ &= nbsp;      | ( ((s->code_ptr-label1_ptr-4)>>2)= & 0x1fffff) );           =                = ;     // bne TMP_REG, disp =0D
+=0D
+  =   //=0D
+    // if we get here, a TLB entry is hit, = r0 contains the guest addr and =0D
+    // r1 contai= ns the ptr that point to tlb_entry.addr_read. what we should=0D
+ &= nbsp;  // do is to load the tlb_entry.addend (64-bit on alpha) and add= it to  =0D
+    // r0 to get the host VA=0D
+  &nbs= p; //=0D
+    tcg_out_movi(s, TCG_TYPE_I64, TMP_REG, \=0D=
+        offsetof(CPUTLBEntry, addend) - = offsetof(CPUTLBEntry, addr_write));        &n= bsp;       // TMP_REG <- distance btw addent an= d addr_write=0D
+    tcg_out_inst4(s, ALPHA_ARITH, r1, TM= P_REG, ARITH_ADDQ, r1);          &n= bsp;               &= nbsp; // addq r1, TMP_REG, r1=0D
+    tcg_out_inst3_disp(= s, ALPHA_LDQ, TMP_REG, r1,  0);        &= nbsp;               =             // ldq TMP_REG, r1= , 0=0D
+    tcg_out_inst4(s, ALPHA_ARITH, r0, TMP_REG, ARITH_ADDQ, r0);            &= nbsp;               = // addq r0, TMP_REG, r0=0D
+=0D
+#else=0D
+    r0 = =3D addr_reg;=0D
+#endif=0D
+=0D
+#ifdef TARGET_WORDS_BIGENDIAN=0D=
+    bswap =3D 1;=0D
+#else=0D
+   = bswap =3D 0;=0D
+#endif=0D
+=0D
+    if ( bswap) {= =0D
+        tcg_abort();=0D
+ &nb= sp;  }=0D
+=0D
+    //=0D
+    = // when we get here, r0 contains the host VA that can be used to access gue= st PA=0D
+    //=0D
+    switch(opc) {= =0D
+    case 0:=0D
+     &nb= sp;  tcg_out_inst3_disp(s, ALPHA_STB, data_reg, r0, 0);  &nb= sp;               &n= bsp;             // stb data_reg, 0(r0)=0D
+    &= nbsp;   break;=0D
+    case 1:=0D
+ &nb= sp;      tcg_out_inst3_disp(s, ALPHA_STW, data_reg= , r0, 0);             &nb= sp;               &n= bsp;  // stw data_reg, 0(r0)=0D
+     &nbs= p;  break;=0D
+    case 2:=0D
+   =      tcg_out_inst3_disp(s, ALPHA_STL, data_reg, r0, 0);=                =                = ; // stl data_reg, 0(r0)=0D
+        = break;=0D
+    case 3:=0D
+    &nb= sp;   tcg_out_inst3_disp(s, ALPHA_STQ, data_reg, r0, 0); &nb= sp;                 = ;             // stq data_reg,= 0(r0)=0D
+        break;=0D
+&nbs= p;   default:=0D
+        t= cg_abort();=0D
+    }=0D
+=0D
+#if defined(CONFIG_S= OFTMMU)=0D
+    /* label2: */=0D
+    *= (uint32_t *)label2_ptr =3D (uint32_t)( ( CONTROL_BR << 26 ) \=0D
+=         | ( TCG_REG_31  << 21 ) | = ( ((s->code_ptr-label2_ptr-4)>>2) & 0x1fffff));=0D
+#endif= =0D
+}=0D
+=0D
+static inline void tgen_ldxx( TCGContext *s, int R= a, int Rb, tcg_target_long disp, int flags)=0D
+{=0D
+  &nb= sp; int opc_array[4] =3D { ALPHA_LDBU, ALPHA_LDWU, ALPHA_LDL, ALPHA_LDQ};= =0D
+    int opc =3D opc_array[flags & 3];=0D
+=0D=
+    if( disp !=3D (int16_t)disp ) {=0D
+        /* disp can= not be stored in insn directly */=0D
+      &nb= sp; tcg_out_movi(s, TCG_TYPE_I64, TMP_REG, disp);     <= br>+        tcg_out_inst4(s, ALPHA_ARITH, Rb,= TMP_REG, ARITH_ADDQ, TMP_REG);         =            // addq r, TMP_REG, TMP_= REG=0D
+        tcg_out_inst3_disp(s, opc,= Ra, TMP_REG, 0);            &= nbsp;               =         // ldx ret, 0(TMP_REG)=0D
+ &= nbsp;  } else {=0D
+        tcg_out_i= nst3_disp(s, opc, Ra, Rb, disp);         = ;                              = ; // ldx ret, disp(r)=0D
+    }=0D
+=0D
+ &nbs= p;  switch ( flags & 7)    {=0D
+  &nb= sp; case 0:=0D
+    case 1:=0D
+    cas= e 2|4:=0D
+    case 3:=0D
+     &n= bsp;  break;=0D
+    case 0|4:=0D
+  &n= bsp;     tcg_out_inst4(s, ALPHA_SEXT, TCG_REG_31, Ra, ARITH_= SEXTB, Ra);             &= nbsp;  // sextb $31, ra, ra=0D
+      &nbs= p; break;=0D
+    case 1|4:=0D
+    &nb= sp;   tcg_out_inst4(s, ALPHA_SEXT, TCG_REG_31, Ra, ARITH_SEXTW, R= a);              &nb= sp; // sextw $31, ra, ra=0D
+        break= ; =0D
+    case 2:=0D
+      &n= bsp; tcg_out_inst4i(s, ALPHA_SHIFT, Ra, 32, ARITH_SLL, Ra);  &nbs= p;               &nb= sp;     // sll ret, 32, ret=0D
+     =    tcg_out_inst4i(s, ALPHA_SHIFT, Ra, 32, ARITH_SRL, Ra); &n= bsp;               &= nbsp;      // srl ret, 32, ret=0D
+   = ;     break;=0D
+    default:=0D
+ = ;       tcg_abort();=0D
+    }= =0D
+}=0D
+=0D
+static inline void tgen_stxx( TCGContext *s, int R= a, int Rb, tcg_target_long disp, int flags)=0D
+{=0D
+  &nb= sp; int opc_array[4] =3D { ALPHA_STB, ALPHA_STW, ALPHA_STL, ALPHA_STQ};=0D<= br>+    int opc =3D opc_array[flags & 3];=0D
+=0D
= +    if( disp !=3D (int16_t)disp ) {=0D
+        /* dis= p cannot be stored in insn directly */=0D
+     &nbs= p;  tcg_out_movi(s, TCG_TYPE_I64, TMP_REG, disp);=0D
+  &= nbsp;     tcg_out_inst4(s, ALPHA_ARITH, Rb, TMP_REG, ARITH_A= DDQ, TMP_REG);            // a= ddq Rb, TMP_REG, TMP_REG=0D
+        tcg_o= ut_inst3_disp(s, opc, Ra, TMP_REG, 0);       =                = ;         // stx Ra, 0(TMP_REG)=0D
+ =    } else {=0D
+        tcg_out_= inst3_disp(s, opc, Ra, Rb, disp);        &nbs= p;               &nb= sp;       // stx Ra, disp(Rb)=0D
+  &= nbsp; } =0D
+}=0D
+=0D
+static inline void tcg_out_op(TCGContext *s, \=0D<= br>+    int opc, const TCGArg *args, const int *const_args)= =0D
+{=0D
+    int oc, c;=0D
+    sw= itch(opc) =0D
+    {=0D
+    case = INDEX_op_exit_tb:=0D
+        /*=0D
+&n= bsp;        * exit_tb t0, where t0 is always = constant and should be returned to engine =0D
+    &= nbsp;    * since we'll back to engine soon, $0 and $1 will n= ever be used=0D
+        */=0D
+ &= nbsp;      tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_0= , args[0]);=0D
+        tcg_out_movi(s, TC= G_TYPE_I64, TMP_REG, (tcg_target_long)tb_ret_addr);=0D
+  &nbs= p;     tcg_out_inst3_func(s, CONTROL_JMP, TCG_REG_31, TMP_RE= G, FUNC_JMP, 0);            // jmp $31, TM= P_REG, hint=0D
+        break;=0D
= +=0D
+    case INDEX_op_goto_tb:=0D
+   = ;     /* goto_tb idx, where idx is constant 0 or 1, indicati= ng the branch # */=0D
+        if (s-= >tb_jmp_offset) {=0D
+         &nb= sp;  /* we don't support direct jmp */=0D
+    =         tcg_abort();=0D
+  =       } else {=0D
+     &nb= sp;      /* indirect jump method */=0D
+  =       tcg_out_movi( s, TCG_TYPE_I64, TMP_REG, (tcg_targ= et_long)(s->tb_next + args[0]));
+      &nbs= p; tcg_out_ld( s, TCG_TYPE_I64, TMP_REG, TMP_REG, 0);
+   = ;     tcg_out_inst3_func(s, CONTROL_JMP, TCG_REG_31, TMP_REG,= FUNC_JMP, 0);        // jmp $31, TMP_REG, hi= nt=0D
+        }=0D
+  &= nbsp;     s->tb_next_offset[args[0]] =3D s->code_= ptr - s->code_buf;=0D
+        bre= ak;=0D
+=0D
+    case INDEX_op_call:=0D
+ &nbs= p;      /* call <ret> <params> ptr, where p= tr has be stored in args[0] */=0D
+      &= nbsp; if (const_args[0]) {=0D
+        &nb= sp;   tcg_abort();=0D
+        }= else {=0D
+            tcg= _out_push( s, TCG_REG_26);=0D
+        &nb= sp;   tcg_out_mov( s, TCG_REG_27, args[0]);
+   = ;         tcg_out_inst3_func(s, CONTROL_CALL, = TCG_REG_26, args[0], FUNC_CALL, 0);=0D
+      &= nbsp;     tcg_out_pop( s, TCG_REG_26);=0D
+  &n= bsp;     }=0D
+       = break;=0D
+=0D
+    case INDEX_op_jmp: =0D
+&= nbsp;       /* jmp t0, where t0 gives the target a= ddress */=0D
+        if (const_args[0]) {= =0D
+            tcg_abort(= );=0D
+        } else {=0D
+  = ;          tcg_out_inst3_func(s, CONTROL= _JMP, TCG_REG_31, args[0], FUNC_JMP, 0);=0D
+     &n= bsp;  }=0D
+        break;=0D
+=0D=
+    case INDEX_op_br: =0D
+    &= nbsp;   /* br idx, where idx gives the label index */=0D
+    &nb= sp;   tcg_out_jxx(s, CONTROL_BR, TMP_REG, args[0]);=0D
+ =        break;=0D
+=0D
+  &nbs= p; case INDEX_op_mov_i32: =0D
+    case INDEX_op_mov= _i64:=0D
+        /* mov_i32/i64 t0, t1, i= mplemented in tcg.c:tcg_reg_alloc_mov() */=0D
+    &= nbsp;   tcg_abort();=0D
+      &= nbsp; break;=0D
+=0D
+    case INDEX_op_movi_i32: = ;=0D
+    case INDEX_op_movi_i64: =0D
+ &nbs= p;      /* movi_i32/i64 t0, t1, implemented in tcg.c:tc= g_reg_alloc_movi() */=0D
+        tcg= _abort();=0D
+        break;=0D
+&= nbsp;        
+    case IND= EX_op_ld8u_i32:  =0D
+    case INDEX_op_ld8u_i64:=0D
+   = ;     /* ld8u_i32/i64 t0, t1, offset */=0D
+  &= nbsp;     tgen_ldxx( s, args[0], args[1], args[2], 0);=0D+        break;=0D
+=0D
+  &= nbsp; case INDEX_op_ld8s_i32: =0D
+    case INDEX_op= _ld8s_i64: =0D
+        /* ld8s_i32/i= 64 t0, t1, offset */=0D
+        tgen_ldxx= ( s, args[0], args[1], args[2], 0|4);=0D
+      = ;  break;=0D
+=0D
+    case INDEX_op_ld16u_i32:= =0D
+    case INDEX_op_ld16u_i64:=0D
+  &nbs= p;     /* ld16u_i32/i64 t0, t1, offset */=0D
+  &nbs= p;       tgen_ldxx( s, args[0], args[1], args[2], = 1);=0D
+        break;=0D
+=0D
+&nbs= p;   case INDEX_op_ld16s_i32:=0D
+    case INDEX_op_ld16s_i64:&nbs= p;=0D
+        /* ld16s_i32/i64 t0, t1, of= fset */=0D
+        tgen_ldxx( s, args[0],= args[1], args[2], 1|4);=0D
+        = break;=0D
+=0D
+    case INDEX_op_ld32u_i64: =0D<= br>+        /* ld32u_i64 t0, t1, offset */=0D=
+        tgen_ldxx( s, args[0], args= [1], args[2], 2);=0D
+        break;= =0D
+=0D
+    case INDEX_op_ld_i32: =0D
+ = ;   case INDEX_op_ld32s_i64:=0D
+     &nbs= p;  /* ld_i32 t0, t1, offset or ld32s_i64 t0, t1, offset */=0D
+&nb= sp;       tgen_ldxx( s, args[0], args[1], args[2],= 2|4);=0D
+        break;=0D
+=0D
+&= nbsp;   case INDEX_op_ld_i64: =0D
+        /* ld_= i32 t0, t1, offset */=0D
+        tge= n_ldxx( s, args[0], args[1], args[2], 3);=0D
+    &n= bsp;   break;=0D
+         =
+    case INDEX_op_st8_i32:=0D
+    ca= se INDEX_op_st8_i64: =0D
+        /* = st8_i32/i64 t0, t1, offset */=0D
+        = tgen_stxx( s, args[0], args[1], args[2], 0);=0D
+    = ;    break;=0D
+=0D
+    case INDEX_op_= st16_i32:=0D
+    case INDEX_op_st16_i64: =0D
+&n= bsp;       /* st16_i32/i64 t0, t1, offset */=0D+        tgen_stxx( s, args[0], args[1], arg= s[2], 1);=0D
+        break;=0D
+= =0D
+    case INDEX_op_st_i32:=0D
+    case INDEX_op_st32_i64:&nb= sp;=0D
+        /* st_i32/st32_i64 t0, t1,= offset */=0D
+        tgen_stxx( s, = args[0], args[1], args[2], 2);=0D
+      &= nbsp; break;=0D
+=0D
+    case INDEX_op_st_i64: = =0D
+        /* st_i64 t0, t1, offset */= =0D
+        tgen_stxx( s, args[0], a= rgs[1], args[2], 3);=0D
+        brea= k;=0D
+=0D
+    case INDEX_op_add_i32: =0D
+&n= bsp;       /* add_i32 t0, t1, t2 */=0D
+ &= nbsp;      oc =3D ALPHA_ARITH;=0D
+   = ;     c =3D ARITH_ADDL;=0D
+    =     goto gen_arith;=0D
+    case INDEX_op_= add_i64:  =0D
+        /* add_i64 t0, t1, t2 */=0D+        oc =3D ALPHA_ARITH;=0D
+ &= nbsp;      c =3D ARITH_ADDQ;=0D
+  &n= bsp;     goto gen_arith;=0D
+    case= INDEX_op_sub_i32: =0D
+        /* su= b_i32 t0, t1, t2 */=0D
+        oc =3D ALP= HA_ARITH;=0D
+        c =3D ARITH_SUB= L;=0D
+        goto gen_arith;=0D
= +    case INDEX_op_sub_i64: =0D
+    =     /* sub_i84 t0, t1, t2 */=0D
+     = ;   oc =3D ALPHA_ARITH;=0D
+     &nbs= p;  c =3D ARITH_SUBQ;=0D
+       = ; goto gen_arith;=0D
+    case INDEX_op_mul_i32: =0D=
+        /* mul_i32 t0, t1, t2 */=0D
+    &nbs= p;   oc =3D ALPHA_MUL;=0D
+      = ;  c =3D ARITH_MULL;=0D
+        goto= gen_arith;=0D
+    case INDEX_op_mul_i64: =0D
+&= nbsp;       /* mul_i64 t0, t1, t2 */=0D
+ =        oc =3D ALPHA_MUL;=0D
+   =      c =3D ARITH_MULQ;=0D
+    &= nbsp;   goto gen_arith;=0D
+    case INDEX_op_a= nd_i32:=0D
+    case INDEX_op_and_i64:=0D
+  = ;      /* and_i32/i64 t0, t1, t2 */=0D
+  =       oc =3D ALPHA_LOGIC;=0D
+   &nbs= p;    c =3D ARITH_AND;=0D
+     =    goto gen_arith;=0D
+    case INDEX_op_or_i32= :=0D
+    case INDEX_op_or_i64: =0D
+        /* or_= i32/i64 t0, t1, t2 */=0D
+        oc =3D A= LPHA_LOGIC;=0D
+        c =3D ARITH_B= IS;=0D
+        goto gen_arith;=0D+    case INDEX_op_xor_i32:=0D
+    case = INDEX_op_xor_i64:=0D
+        /* xor_i32/i= 64 t0, t1, t2 */=0D
+        oc =3D ALPHA_= LOGIC;=0D
+        c =3D ARITH_XOR;= =0D
+        goto gen_arith;=0D
+ =    case INDEX_op_shl_i32:=0D
+    case INDEX_op= _shl_i64:=0D
+        /* shl_i32/i64 t0, t= 1, t2 */=0D
+        oc =3D ALPHA_SHIFT;= =0D
+        c =3D ARITH_SLL;=0D
+=         goto gen_arith;=0D
+    case INDEX_op_shr_i32:=0D
+&n= bsp;       tcg_out_inst4i(s, ALPHA_SHIFT, args[0],= 32, ARITH_SLL, args[0]);
+        tcg_out= _inst4i(s, ALPHA_SHIFT, args[0], 32, ARITH_SRL, args[0]);
+  &= nbsp; case INDEX_op_shr_i64: =0D
+      &n= bsp; /* shr_i32/i64 t0, t1, t2 */=0D
+      &nb= sp; oc =3D ALPHA_SHIFT;=0D
+        c= =3D ARITH_SRL;=0D
+        goto gen_= arith;=0D
+    case INDEX_op_sar_i32:=0D   = ;
+        tcg_out_inst4i(s, ALPHA_SHIFT,= args[0], 32, ARITH_SLL, args[0]);
+       = ; tcg_out_inst4i(s, ALPHA_SHIFT, args[0], 32, ARITH_SRA, args[0]);
+&nbs= p;   case INDEX_op_sar_i64:=0D
+      = ;  /* sar_i32/i64 t0, t1, t2 */=0D
+        oc = =3D ALPHA_SHIFT;=0D
+        c =3D AR= ITH_SRA;=0D
+    gen_arith:=0D
+   &nbs= p;    if (const_args[2]) {=0D
+    &n= bsp;       tgen_arithi(s, oc, c, args[0], arg= s[2]);=0D
+        } else {=0D
+&n= bsp;           tcg_out_in= st4(s, oc, args[0], args[2], c, args[0]);=0D
+    &n= bsp;   }=0D
+        break;= =0D
+=0D
+    case INDEX_op_brcond_i32:=0D
+ &= nbsp;  case INDEX_op_brcond_i64:=0D
+      = ;  /* brcond_i32/i64 t0, t1, cond, label */=0D
+   &= nbsp;    tcg_out_brcond(s, args[2], args[0], args[1], const_= args[1], args[3]); =0D
+        break;=0D
+=0D
+&n= bsp;   case INDEX_op_qemu_ld8u:=0D
+    &n= bsp;   tcg_out_qemu_ld(s, args, 0);=0D
+   &nbs= p;    break;=0D
+    case INDEX_op_qemu_ld= 8s:=0D
+        tcg_out_qemu_ld(s, ar= gs, 0 | 4);=0D
+        break;=0D
= +    case INDEX_op_qemu_ld16u:=0D
+   &nbs= p;    tcg_out_qemu_ld(s, args, 1);=0D
+   =      break;=0D
+    case INDEX_op_qem= u_ld16s:=0D
+        tcg_out_qemu_ld(= s, args, 1 | 4);=0D
+        break;= =0D
+    case INDEX_op_qemu_ld32u:=0D
+  &nb= sp;     tcg_out_qemu_ld(s, args, 2); =0D
+        break;=0D
+ &nbs= p;  case INDEX_op_qemu_ld32s:=0D
+     &nb= sp;  tcg_out_qemu_ld(s, args, 2 | 4);=0D
+    &= nbsp;   break;=0D
+    case INDEX_op_qemu_ld64:= =0D
+        tcg_out_qemu_ld(s, args,= 3);=0D
+        break;=0D
+=0D+    case INDEX_op_qemu_st8:=0D
+    = ;    tcg_out_qemu_st(s, args, 0);=0D
+   &= nbsp;    break;=0D
+    case INDEX_op_qemu= _st16:=0D
+        tcg_out_qemu_st(s,= args, 1);=0D
+        break;=0D
+=     case INDEX_op_qemu_st32:=0D
+    =     tcg_out_qemu_st(s, args, 2);=0D
+   &n= bsp;    break;=0D
+    case INDEX_op_qemu_st64:=0D
+ &nb= sp;      tcg_out_qemu_st(s, args, 3);=0D
+ = ;       break;=0D
+=0D
+  &nb= sp; case INDEX_op_div2_i32:=0D
+    case INDEX_op_divu2_i= 32:=0D
+    default:=0D
+     = ;   tcg_abort();=0D
+    }=0D
+
+ &n= bsp;          tcg_out_inst4(s,= ALPHA_LOGIC, 31, 31, ARITH_AND, 31);
+}=0D
+=0D
+static const TCG= TargetOpDef alpha_op_defs[] =3D {=0D
+    { INDEX_op_exit= _tb, { } },=0D
+    { INDEX_op_goto_tb, { } },=0D
+&nb= sp;   { INDEX_op_call, { "r" } },
+    { INDEX_= op_jmp, { "r" } },
+    { INDEX_op_br, { } },=0D
+=0D<= br>+    { INDEX_op_mov_i32, { "r", "r" } },
+  =   { INDEX_op_movi_i32, { "r" } },=0D
+    { INDEX_op_ld8u_i32, { "r", "r" } },+    { INDEX_op_ld8s_i32, { "r", "r" } },=0D
+ &nbs= p;  { INDEX_op_ld16u_i32, { "r", "r" } },=0D
+    { = INDEX_op_ld16s_i32, { "r", "r" } },=0D
+    { INDEX_op_ld= _i32, { "r", "r" } },=0D
+    { INDEX_op_st8_i32, { "r", = "r" } },
+    { INDEX_op_st16_i32, { "r", "r" } },=0D
= +    { INDEX_op_st_i32, { "r", "r" } },=0D
+=0D
+ = ;   { INDEX_op_add_i32, { "r", "0", "ri" } },=0D
+  =   { INDEX_op_mul_i32, { "r", "0", "ri" } },=0D
+    = //{ INDEX_op_div2_i32, { "a", "d", "0", "1", "r" } },=0D
+  &n= bsp; //{ INDEX_op_divu2_i32, { "a", "d", "0", "1", "r" } },=0D
+ &n= bsp;  { INDEX_op_sub_i32, { "r", "0", "ri" } },=0D
+  &nb= sp; { INDEX_op_and_i32, { "r", "0", "ri" } },=0D
+    { I= NDEX_op_or_i32, { "r", "0", "ri" } },=0D
+    { INDEX_op_xor_i32, { "r", "= 0", "ri" } },=0D
+=0D
+    { INDEX_op_shl_i32, { "r", = "0", "ri" } },=0D
+    { INDEX_op_shr_i32, { "r", "0", "r= i" } },=0D
+    { INDEX_op_sar_i32, { "r", "0", "ri" } },= =0D
+=0D
+    { INDEX_op_brcond_i32, { "r", "ri" } },&= nbsp;        
+=0D
+    = { INDEX_op_mov_i64, { "r", "r" } },     
+ &nbs= p;  { INDEX_op_movi_i64, { "r" } },=0D
+    { INDEX_= op_ld8u_i64, { "r", "r" } },=0D
+    { INDEX_op_ld8s_i64,= { "r", "r" } },=0D
+    { INDEX_op_ld16u_i64, { "r", "r"= } },=0D
+    { INDEX_op_ld16s_i64, { "r", "r" } },=0D+    { INDEX_op_ld32u_i64, { "r", "r" } },=0D
+ &nb= sp;  { INDEX_op_ld32s_i64, { "r", "r" } },=0D
+    {= INDEX_op_ld_i64, { "r", "r" } },=0D
+    { INDEX_op_st8_i64, { "r", "r" } }= ,     
+    { INDEX_op_st16_i64, { "r= ", "r" } },=0D
+    { INDEX_op_st32_i64, { "r", "r" } },= =0D
+    { INDEX_op_st_i64, { "r", "r" } },=0D
+=0D+    { INDEX_op_add_i64, { "r", "0", "ri" } },=0D
+ = ;   { INDEX_op_mul_i64, { "r", "0", "ri" } },=0D
+  =   //{ INDEX_op_div2_i64, { "a", "d", "0", "1", "r" } },=0D
+ &= nbsp;  //{ INDEX_op_divu2_i64, { "a", "d", "0", "1", "r" } },=0D
+&= nbsp;   { INDEX_op_sub_i64, { "r", "0", "ri" } },=0D
+ &n= bsp;  { INDEX_op_and_i64, { "r", "0", "ri" } },=0D
+  &nb= sp; { INDEX_op_or_i64, { "r", "0", "ri" } },=0D
+    { IN= DEX_op_xor_i64, { "r", "0", "ri" } },=0D
+=0D
+    { I= NDEX_op_shl_i64, { "r", "0", "ri" } },=0D
+    { INDEX_op= _shr_i64, { "r", "0", "ri" } },=0D
+    { INDEX_op_sar_i64, { "r", "0", "ri" }= },=0D
+=0D
+    { INDEX_op_brcond_i64, { "r", "ri" } = },=0D
+=0D
+    { INDEX_op_qemu_ld8u, { "r", "L" } },= =0D
+    { INDEX_op_qemu_ld8s, { "r", "L" } },=0D
+&nb= sp;   { INDEX_op_qemu_ld16u, { "r", "L" } },=0D
+  &= nbsp; { INDEX_op_qemu_ld16s, { "r", "L" } },=0D
+    { IN= DEX_op_qemu_ld32u, { "r", "L" } },=0D
+    { INDEX_op_qem= u_ld32s, { "r", "L" } },=0D
+    { INDEX_op_qemu_ld64, { = "r", "L" } },=0D
+=0D
+    { INDEX_op_qemu_st8, { "L",= "L" } },=0D
+    { INDEX_op_qemu_st16, { "L", "L" } },= =0D
+    { INDEX_op_qemu_st32, { "L", "L" } },=0D
+&nb= sp;   { INDEX_op_qemu_st64, { "L", "L", "L" } },=0D
+=0D
+&= nbsp;   { -1 },=0D
+};=0D
+=0D
+=0D
+static int tcg_t= arget_callee_save_regs[] =3D { =0D
+    /* TCG_REG_15, */      =                 = ;          // used for the global env, s= o no need to save=0D
+    TCG_REG_9,=0D
+  &= nbsp; TCG_REG_10,=0D
+    TCG_REG_11,=0D
+  =   TCG_REG_12,=0D
+    TCG_REG_13,=0D
+  = ;  TCG_REG_14=0D
+};=0D
+=0D
+/*=0D
+ * Generate global QE= MU prologue and epilogue code =0D
+*/=0D
+void tcg_target_qemu_p= rologue(TCGContext *s)=0D
+{=0D
+    int i, frame_size= , push_size, stack_addend;=0D
+    =0D
+ &nb= sp;  /* TB prologue */=0D
+/*printf("TB prologue @ %lx\n", s->co= de_ptr);*/
+     
+    /* save TCG= _REG_26 */=0D
+    tcg_out_push(s, TCG_REG_26);=0D
+= =0D
+    /* save all callee saved registers */=0D
+    for(i =3D 0; i <= ; ARRAY_SIZE(tcg_target_callee_save_regs); i++) {=0D
+   =     tcg_out_push(s, tcg_target_callee_save_regs[i]);=0D
= +    }=0D
+     
+  &nbs= p; /* reserve some stack space */=0D
+    push_size =3D 8= + (1 + ARRAY_SIZE(tcg_target_callee_save_regs)) * 8;=0D
+  &n= bsp; frame_size =3D push_size + TCG_STATIC_CALL_ARGS_SIZE;=0D
+ &nb= sp;  frame_size =3D (frame_size + TCG_TARGET_STACK_ALIGN - 1) & ~(= TCG_TARGET_STACK_ALIGN - 1);=0D
+    stack_addend =3D fra= me_size - push_size;=0D
+    tcg_out_addi(s, TCG_REG_30, = -stack_addend);=0D
+=0D
+    tcg_out_inst3_func(s, CON= TROL_JMP, TCG_REG_31, TCG_REG_16, FUNC_JMP, 0);     &nb= sp;  /* jmp $16 */=0D
+=0D
+    /* TB epilogue */= =0D
+    tb_ret_addr =3D s->code_ptr;=0D
+    tcg_out_addi(s, = TCG_REG_30, stack_addend);=0D
+    for(i =3D ARRAY_SIZE(t= cg_target_callee_save_regs) - 1; i >=3D 0; i--) {=0D
+  &nb= sp;     tcg_out_pop(s, tcg_target_callee_save_regs[i]);= =0D
+    }=0D
+=0D
+    tcg_out_pop(= s, TCG_REG_26);=0D
+    tcg_out_inst3_func(s, CONTROL_RET= , TCG_REG_31, TCG_REG_26, FUNC_RET, 0);       = ; /* ret */=0D
+}=0D
+=0D
+=0D
+void tcg_target_init(TCGContext= *s)=0D
+{=0D
+    /* fail safe */=0D
+  =   if ((1 << CPU_TLB_ENTRY_BITS) !=3D sizeof(CPUTLBEntry))=0D
= +        tcg_abort();=0D
+=0D
+&nb= sp;   tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0= , 0xffffffff);
+    tcg_regset_set32(tcg_target_available= _regs[TCG_TYPE_I64], 0, 0xffffffff);=0D
+    tcg_regset_set32(tcg_target_call_cl= obber_regs, 0,=0D
+        (1 << TCG= _REG_1  ) | (1 << TCG_REG_2 ) | (1 << TCG_REG_3  ) | = (1 << TCG_REG_4 ) |=0D
+        (1 &= lt;< TCG_REG_5  ) | (1 << TCG_REG_6 ) | (1 << TCG_REG_7=   ) | (1 << TCG_REG_8 ) | =0D
+     =    (1 << TCG_REG_22) | (1 << TCG_REG_23) | (1 <<= ; TCG_REG_24) | (1 << TCG_REG_25) | =0D
+   &n= bsp;          (1 << TCG_= REG_16) | (1 << TCG_REG_17) | (1 << TCG_REG_18) | (1 << T= CG_REG_19) | =0D
+        &= nbsp;     (1 << TCG_REG_20) | (1 << TCG_REG= _21) | (1 << TCG_REG_0 ));=0D
+     =0D
+    tcg_regset_clear(s->reserved_regs);=0D
+&n= bsp;   tcg_regset_set_reg(s->reserved_regs, TCG_REG_26);=0D+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_27);= =0D
+    tcg_regset_set_reg(s->reserved_regs, TCG_REG_= 28);=0D
+    tcg_regset_set_reg(s->reserved_regs, TCG_= REG_29);=0D
+    tcg_regset_set_reg(s->reserved_regs, = TCG_REG_30);=0D
+    tcg_regset_set_reg(s->reserved_re= gs, TCG_REG_31);    // $15, $26~$31 not alloced by tcg.c=0D<= br>+    tcg_regset_set_reg(s->reserved_regs, TMP_REG);&nb= sp;       // reserved register for used in this fi= le=0D
+=0D
+    tcg_add_target_add_op_defs(alpha_op_de= fs);=0D
+    printf("tcg_init called.\n");
+}=0D
+= =0D
diff -urN qemu-0.10.0/tcg/alpha/tcg-target.h qemu-0.10.0.alpha/tcg/alpha/tcg-target.h
--- qemu-0.10.0/tcg/alpha/tcg-= target.h    1969-12-31 16:00:00.000000000 -0800
+++ qemu-= 0.10.0.alpha/tcg/alpha/tcg-target.h    2009-10-23 23:09:46.0= 00000000 -0700
@@ -0,0 +1,60 @@
+/*=0D
+ * Tiny Code Generator for= QEMU=0D
+ *=0D
+ * Copyright (c) 2008 Fabrice Bellard=0D
+ *=0D+ * Permission is hereby granted, free of charge, to any person obtaining= a copy=0D
+ * of this software and associated documentation files (the = "Software"), to deal=0D
+ * in the Software without restriction, includi= ng without limitation the rights=0D
+ * to use, copy, modify, merge, pub= lish, distribute, sublicense, and/or sell=0D
+ * copies of the Software,= and to permit persons to whom the Software is=0D
+ * furnished to do so= , subject to the following conditions:=0D
+ *=0D
+ * The above copyri= ght notice and this permission notice shall be included in=0D
+ * all co= pies or substantial portions of the Software.=0D
+ *=0D
+ * THE SOFTWARE IS PROVIDED "AS= IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR=0D
+ * IMPLIED, INCLUDING= BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,=0D
+ * FITNESS FO= R A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL=0D
+ * THE= AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER=0D<= br>+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARIS= ING FROM,=0D
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR= OTHER DEALINGS IN=0D
+ * THE SOFTWARE.=0D
+ */=0D
+#define TCG_TA= RGET_ALPHA 1=0D
+=0D
+#define TCG_TARGET_REG_BITS 64=0D
+=0D
+#= define TCG_TARGET_NB_REGS 32=0D
+=0D
+enum {=0D
+   = ; TCG_REG_0 =3D 0, TCG_REG_1, TCG_REG_2, TCG_REG_3,=0D
+   &nb= sp; TCG_REG_4, TCG_REG_5, TCG_REG_6, TCG_REG_7,=0D
+    T= CG_REG_8, TCG_REG_9, TCG_REG_10, TCG_REG_11,=0D
+    TCG_= REG_12, TCG_REG_13, TCG_REG_14, TCG_REG_15,=0D
+    TCG_REG_16, TCG_REG_17, TCG_REG_18, = TCG_REG_19,=0D
+    TCG_REG_20, TCG_REG_21, TCG_REG_22, T= CG_REG_23,=0D
+    TCG_REG_24, TCG_REG_25, TCG_REG_26, TC= G_REG_27,=0D
+    TCG_REG_28, TCG_REG_29, TCG_REG_30, TCG= _REG_31=0D
+};=0D
+=0D
+/* used for function call generation */=0D=
+#define TCG_REG_CALL_STACK TCG_REG_30 =0D
+#define TCG_TARGET_= STACK_ALIGN 16=0D
+#define TCG_TARGET_CALL_STACK_OFFSET 0=0D
+=0D
= +/* Note: must be synced with dyngen-exec.h */=0D
+#define TCG_AREG0 TCG= _REG_15=0D
+#define TCG_AREG1 TCG_REG_9=0D
+#define TCG_AREG2 TCG_REG= _10=0D
+#define TCG_AREG3 TCG_REG_11=0D
+#define TCG_AREG4 TCG_REG_12= =0D
+#define TCG_AREG5 TCG_REG_13=0D
+#define TCG_AREG6 TCG_REG_14=0D=
+=0D
+#define TMP_REG TCG_REG_25=0D
+=0D
+static inline void f= lush_icache_range(unsigned long start, unsigned long stop)=0D
+{
+&nb= sp;   asm("call_pal 0x86");
+}=0D



=0A=0A=0A
=E5=A5=BD=E7=8E=A9=E8=B4=BA=E5=8D=A1=E7=AD=89=E4=BD=A0= =E5=8F=91=EF=BC=8C=E9=82=AE=E7=AE=B1=E8=B4=BA=E5=8D=A1=E5=85=A8=E6=96=B0=E4= =B8=8A=E7=BA=BF=EF=BC=81 --0-1643191695-1260026623=:6550--