Received: from eggs.gnu.org ([2001:4830:134:3::10]:35781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfFPu-0007RA-8F for qemu-devel@nongnu.org; Thu, 24 Sep 2015 18:55:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfFPp-0004oH-9K for qemu-devel@nongnu.org; Thu, 24 Sep 2015 18:55:06 -0400 Received: from blu004-omc2s1.hotmail.com ([65.55.111.76]:50194) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfFPp-0004nz-6A for qemu-devel@nongnu.org; Thu, 24 Sep 2015 18:55:01 -0400 Message-ID: Date: Fri, 25 Sep 2015 06:57:11 +0800 From: Chen Gang MIME-Version: 1.0 References: <1442961491-3329-1-git-send-email-gang.chen.5i5j@gmail.com> <5602F0A7.5030804@twiddle.net> In-Reply-To: <5602F0A7.5030804@twiddle.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] tilegx: Support raise instruction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , gang.chen.5i5j@gmail.com, peter.maydell@linaro.org Cc: cmetcalf@ezchip.com, qemu-devel@nongnu.org On 9/24/15 02:34=2C Richard Henderson wrote: > You forgot to cc qemu-devel. >=20 Oh=2C we can not find it in qemu mail archive list. But I really cc qemu-devel. When I send the next patches=2C I'll notice about it=2C if still "can not c= c qemu-devel"=2C I shall try to send patches from my hotmail client. > This patch needs to be split. >=20 OK. > On 09/22/2015 03:38 PM=2C gang.chen.5i5j@gmail.com wrote: >> =20 >> +static int sigdata_code(uint64_t sigdata) >> +{ >> + return (sigdata & 0x3ff) >> 6=3B >> +} >> + >> +static int sigdata_no(uint64_t sigdata) >> +{ >> + return sigdata & 0x3f=3B >> +} >> + >> +static void do_raise(CPUTLGState *env) >> +{ >> + target_siginfo_t info=3B >> + >> + info.si_signo =3D sigdata_no(env->sigdata)=3B >> + info.si_errno =3D 0=3B >> + info.si_code =3D sigdata_code(env->sigdata)=3B >> + info._sifields._sigfault._addr =3D env->pc=3B >> + queue_signal(env=2C info.si_signo=2C &info)=3B >> +} >=20 >=20 > This should look much more like the linux kernel code=2C where instead of= passing > "sigdata"=2C we load the instruction that faulted and parse out the data.= You > should only need TILEGX_EXCP_OPCODE_ILL. > OK=2C thank=2C I will try=2C next. >>=20 >> + env->spregs[TILEGX_SPR_EX_CONTEXT_1] =3D TILEGX_PL_ICS_EX1(TILEGX_U= SER_PL=2C 1)=3B >> + env->regs[TILEGX_R_SP] =3D (unsigned long) frame=3B >> + env->regs[TILEGX_R_LR] =3D restorer=3B >> + env->regs[0] =3D (unsigned long) sig=3B >> + env->regs[1] =3D (unsigned long) &frame->info=3B >> + env->regs[2] =3D (unsigned long) &frame->uc=3B >> + /* regs->flags |=3D PT_FLAGS_CALLER_SAVES=3B FIXME: we can skip it?= */ >> + >> + unlock_user_struct(frame=2C frame_addr=2C 1)=3B >> + return=3B >> + >> +give_sigsegv: >> + if (sig =3D=3D TARGET_SIGSEGV) { >> + ka->_sa_handler =3D TARGET_SIG_DFL=3B >> + } >> + force_sig(TARGET_SIGSEGV /* =2C current */)=3B >> +} >> + >> +/* kernel: arch/tile/kernel/signal.c */ >> +long do_rt_sigreturn(CPUArchState *env) >> +{ >> + fprintf(stderr=2C "do_rt_sigreturn: not implemented\n")=3B >> + return -TARGET_ENOSYS=3B >> +} >> + >=20 > The introduction of signal handling needs to be it's own patch. >=20 OK=2C thanks. > I'm also disapointed that you didn't fill in rt_sigreturn=3B there's no p= oint in > not doing them together. >=20 This patch is only for raise insn=2C so I only implement the related code for raise. But=2C OK=2C I will let them together in one patch=2C next. >> =20 >> #include "exec/cpu-defs.h" >> +#include "spr_def_64.h" >> =20 >> +#define TILEGX_EX1_PL(ex1) \ >> + (((ex1) >> SPR_EX_CONTEXT_1_1__PL_SHIFT) & SPR_EX_CONTEXT_1_1__PL_RMA= SK) >> +#define TILEGX_EX1_ICS(ex1) \ >> + (((ex1) >> SPR_EX_CONTEXT_1_1__ICS_SHIFT) & SPR_EX_CONTEXT_1_1__ICS_R= MASK) >> +#define TILEGX_PL_ICS_EX1(pl=2C ics) \ >> + (((pl) << SPR_EX_CONTEXT_1_1__PL_SHIFT) | \ >> + ((ics) << SPR_EX_CONTEXT_1_1__ICS_SHIFT)) >> + >> +#define TILEGX_USER_PL 0 >=20 > What's this for? It appears to be something unrelated and not used. > The previous setup_rt_frame() will use some of them. But it is OK for me to move them to the related file.=20 =20 >> =20 >> case OE(ADDLI_OPCODE_X0=2C 0=2C X0): >> case OE(ADDLI_OPCODE_X1=2C 0=2C X1): >> - tcg_gen_addi_tl(tdest=2C tsrca=2C imm)=3B >> + if ((srca =3D=3D TILEGX_R_ZERO) && (dest =3D=3D TILEGX_R_ZERO))= { >> + t0 =3D tcg_const_tl(imm & 0xffff)=3B >> + tcg_gen_st_tl(t0=2C cpu_env=2C offsetof(CPUTLGState=2C sigd= ata))=3B >> + tcg_temp_free(t0)=3B >> + } else { >> + tcg_gen_addi_tl(tdest=2C tsrca=2C imm)=3B >> + } >> mnemonic =3D "addli"=3B >> break=3B >> case OE(ADDXLI_OPCODE_X0=2C 0=2C X0): >> >=20 > Certainly you should not be complicating addli like this. >=20 OK=2C I'll try. Thanks. --=20 Chen Gang (=E9=99=88=E5=88=9A) Open=2C share=2C and attitude like air=2C water=2C and life which God bless= ed