From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5028 invoked by alias); 19 Jan 2004 06:29:26 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 5014 invoked from network); 19 Jan 2004 06:29:22 -0000 Received: from unknown (HELO mail02.idc.renesas.com) (202.234.163.13) by sources.redhat.com with SMTP; 19 Jan 2004 06:29:22 -0000 Received: (from root@localhost) by guardian02.idc.renesas.com with id i0J6TI12008044; Mon, 19 Jan 2004 15:29:18 +0900 (JST) Received: from unknown [172.20.8.70] by guardian02.idc.renesas.com with SMTP id RAA08043 ; Mon, 19 Jan 2004 15:29:18 +0900 Received: from dnma02 (dnma02.rso.renesas.com [10.15.11.200]) by dnma01.rso.renesas.com (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with ESMTP id <0HRQ00F3G4OSXA@dnma01.rso.renesas.com>; Mon, 19 Jan 2004 15:29:16 +0900 (JST) Received: from t1pcapricot.tool.maec.co.jp ([10.145.105.37]) by dnma02.rso.renesas.com (iPlanet Messaging Server 5.2 HotFix 1.12 (built Feb 13 2003)) with SMTP id <0HRQ007834ORSH@dnma02.rso.renesas.com>; Mon, 19 Jan 2004 15:29:15 +0900 (JST) Date: Mon, 19 Jan 2004 06:29:00 -0000 From: Kazuhiro Inaoka Subject: Re: [PATCH] fix trap in parallel for m32r-sim To: Doug Evans Cc: Andrew Cagney , gdb-patches@sources.redhat.com Message-id: <002401c3de56$6dcfe240$2569910a@tool.maec.co.jp> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_T+NRc+WdKWrVmW6NNJ/zcw)" References: <005301c3dbe1$6352c840$2569910a@tool.maec.co.jp> <16391.23988.251985.754761@claire.transmeta.com> <006d01c3dbf6$5edebfc0$2569910a@tool.maec.co.jp> <16392.21351.39235.645495@claire.transmeta.com> X-SW-Source: 2004-01/txt/msg00497.txt.bz2 This is a multi-part message in MIME format. --Boundary_(ID_T+NRc+WdKWrVmW6NNJ/zcw) Content-type: text/plain; charset=iso-2022-jp Content-transfer-encoding: 7BIT Content-length: 741 Hi Doug, I want to fix the following problem. test pattern is: main() { asm("trap #0 || ldi r0,#1"); /* the same as exit() ? */ abort(); } command line: m32r-elf-gcc -m32rx test.c In this case, it will pass through an asm function without exit. At the time of m32r_trap() execution, r0 is not 1 yet. It's not a problem of the current simulator implementation for trap instruction. I think it's a problem of timing to call back system call when trap is in parallel. Changed a patch and comment. Regards, Kazuhiro Inaoka sim/m32r/ChangeLog 2004-01-19 Kazuhiro Inaoka < inaoka dot kazuhiro at renesas dot com > * mloopx.in (xextract-pbb): Fixed trap for system calls operation in parallel. * mloop2.in (xextract-pbb): Ditto. --Boundary_(ID_T+NRc+WdKWrVmW6NNJ/zcw) Content-type: application/octet-stream; name=sim.patch Content-transfer-encoding: quoted-printable Content-disposition: attachment; filename=sim.patch Content-length: 9158 Index: mloop2.in=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/sim/m32r/mloop2.in,v=0A= retrieving revision 1.1=0A= diff -c -r1.1 mloop2.in=0A= *** mloop2.in 12 Dec 2003 16:35:21 -0000 1.1=0A= --- mloop2.in 19 Jan 2004 04:34:48 -0000=0A= ***************=0A= *** 289,303 ****=0A= {=0A= if ((insn & 0x8000) !=3D 0) /* parallel? */=0A= {=0A= ! /* Yep. Here's the "interesting" [sic] part. */=0A= ! idesc =3D emit_parallel (current_cpu, pc, insn, sc, 1);=0A= ! sc +=3D 3;=0A= ! max_insns -=3D 3;=0A= icount +=3D 2;=0A= pc +=3D 4;=0A= if (IDESC_CTI_P (idesc))=0A= {=0A= ! SET_CTI_VPC (sc - 3);=0A= break;=0A= }=0A= }=0A= --- 289,321 ----=0A= {=0A= if ((insn & 0x8000) !=3D 0) /* parallel? */=0A= {=0A= ! int up_count;=0A= !=20=0A= ! if (((insn >> 16) & 0xfff0) =3D=3D 0x10f0)=0A= ! {=0A= ! /* FIXME: No need to handle this sequentially if system=0A= ! calls will be able to execute after second insn in=0A= ! parallel. ( trap #num || insn ) */=0A= ! /* insn */=0A= ! idesc =3D emit_16 (current_cpu, pc + 2, insn & 0x7fff,=0A= ! sc, 1, 0);=0A= ! /* trap */=0A= ! emit_16 (current_cpu, pc, insn >> 16, sc + 1, 1, 0);=0A= ! up_count =3D 2;=0A= ! }=0A= ! else=0A= ! {=0A= ! /* Yep. Here's the "interesting" [sic] part. */=0A= ! idesc =3D emit_parallel (current_cpu, pc, insn, sc, 1);=0A= ! up_count =3D 3;=0A= ! }=0A= ! sc +=3D up_count;=0A= ! max_insns -=3D up_count;=0A= icount +=3D 2;=0A= pc +=3D 4;=0A= if (IDESC_CTI_P (idesc))=0A= {=0A= ! SET_CTI_VPC (sc - up_count);=0A= break;=0A= }=0A= }=0A= ***************=0A= *** 375,392 ****=0A= Only emit before/after handlers if necessary. */=0A= if (trace_p || profile_p)=0A= {=0A= ! idesc =3D emit_full_parallel (current_cpu, pc, insn, sc,=0A= ! trace_p, profile_p);=0A= cti_sc =3D sc + 1;=0A= sc +=3D 6;=0A= max_insns -=3D 6;=0A= }=0A= else=0A= {=0A= ! idesc =3D emit_parallel (current_cpu, pc, insn, sc, 0);=0A= cti_sc =3D sc;=0A= ! sc +=3D 3;=0A= ! max_insns -=3D 3;=0A= }=0A= icount +=3D 2;=0A= pc +=3D 4;=0A= --- 393,443 ----=0A= Only emit before/after handlers if necessary. */=0A= if (trace_p || profile_p)=0A= {=0A= ! if (((insn >> 16) & 0xfff0) =3D=3D 0x10f0)=0A= ! {=0A= ! /* FIXME: No need to handle this sequentially if=0A= ! system calls will be able to execute after second=0A= ! insn in parallel. ( trap #num || insn ) */=0A= ! /* insn */=0A= ! idesc =3D emit_full16 (current_cpu, pc + 2,=0A= ! insn & 0x7fff, sc, 0, 0);=0A= ! /* trap */=0A= ! emit_full16 (current_cpu, pc, insn >> 16, sc + 3,=0A= ! 0, 0);=0A= ! }=0A= ! else=0A= ! {=0A= ! idesc =3D emit_full_parallel (current_cpu, pc, insn,=0A= ! sc, trace_p, profile_p);=0A= ! }=0A= cti_sc =3D sc + 1;=0A= sc +=3D 6;=0A= max_insns -=3D 6;=0A= }=0A= else=0A= {=0A= ! int up_count;=0A= !=20=0A= ! if (((insn >> 16) & 0xfff0) =3D=3D 0x10f0)=0A= ! {=0A= ! /* FIXME: No need to handle this sequentially if=0A= ! system calls will be able to execute after second=0A= ! insn in parallel. ( trap #num || insn ) */=0A= ! /* insn */=0A= ! idesc =3D emit_16 (current_cpu, pc + 2, insn & 0x7fff,=0A= ! sc, 0, 0);=0A= ! /* trap */=0A= ! emit_16 (current_cpu, pc, insn >> 16, sc + 1, 0, 0);=0A= ! up_count =3D 2;=0A= ! }=0A= ! else=0A= ! {=0A= ! idesc =3D emit_parallel (current_cpu, pc, insn, sc, 0);=0A= ! up_count =3D 3;=0A= ! }=0A= cti_sc =3D sc;=0A= ! sc +=3D up_count;=0A= ! max_insns -=3D up_count;=0A= }=0A= icount +=3D 2;=0A= pc +=3D 4;=0A= Index: mloopx.in=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/sim/m32r/mloopx.in,v=0A= retrieving revision 1.1.1.1=0A= diff -c -r1.1.1.1 mloopx.in=0A= *** mloopx.in 12 Oct 1999 04:37:53 -0000 1.1.1.1=0A= --- mloopx.in 19 Jan 2004 04:34:48 -0000=0A= ***************=0A= *** 289,303 ****=0A= {=0A= if ((insn & 0x8000) !=3D 0) /* parallel? */=0A= {=0A= ! /* Yep. Here's the "interesting" [sic] part. */=0A= ! idesc =3D emit_parallel (current_cpu, pc, insn, sc, 1);=0A= ! sc +=3D 3;=0A= ! max_insns -=3D 3;=0A= icount +=3D 2;=0A= pc +=3D 4;=0A= if (IDESC_CTI_P (idesc))=0A= {=0A= ! SET_CTI_VPC (sc - 3);=0A= break;=0A= }=0A= }=0A= --- 289,321 ----=0A= {=0A= if ((insn & 0x8000) !=3D 0) /* parallel? */=0A= {=0A= ! int up_count;=0A= !=20=0A= ! if (((insn >> 16) & 0xfff0) =3D=3D 0x10f0)=0A= ! {=0A= ! /* FIXME: No need to handle this sequentially if system=0A= ! calls will be able to execute after second insn in=0A= ! parallel. ( trap #num || insn ) */=0A= ! /* insn */=0A= ! idesc =3D emit_16 (current_cpu, pc + 2, insn & 0x7fff,=0A= ! sc, 1, 0);=0A= ! /* trap */=0A= ! emit_16 (current_cpu, pc, insn >> 16, sc + 1, 1, 0);=0A= ! up_count =3D 2;=0A= ! }=0A= ! else=0A= ! {=0A= ! /* Yep. Here's the "interesting" [sic] part. */=0A= ! idesc =3D emit_parallel (current_cpu, pc, insn, sc, 1);=0A= ! up_count =3D 3;=0A= ! }=0A= ! sc +=3D up_count;=0A= ! max_insns -=3D up_count;=0A= icount +=3D 2;=0A= pc +=3D 4;=0A= if (IDESC_CTI_P (idesc))=0A= {=0A= ! SET_CTI_VPC (sc - up_count);=0A= break;=0A= }=0A= }=0A= ***************=0A= *** 375,392 ****=0A= Only emit before/after handlers if necessary. */=0A= if (trace_p || profile_p)=0A= {=0A= ! idesc =3D emit_full_parallel (current_cpu, pc, insn, sc,=0A= ! trace_p, profile_p);=0A= cti_sc =3D sc + 1;=0A= sc +=3D 6;=0A= max_insns -=3D 6;=0A= }=0A= else=0A= {=0A= ! idesc =3D emit_parallel (current_cpu, pc, insn, sc, 0);=0A= cti_sc =3D sc;=0A= ! sc +=3D 3;=0A= ! max_insns -=3D 3;=0A= }=0A= icount +=3D 2;=0A= pc +=3D 4;=0A= --- 393,443 ----=0A= Only emit before/after handlers if necessary. */=0A= if (trace_p || profile_p)=0A= {=0A= ! if (((insn >> 16) & 0xfff0) =3D=3D 0x10f0)=0A= ! {=0A= ! /* FIXME: No need to handle this sequentially if=0A= ! system calls will be able to execute after second=0A= ! insn in parallel. ( trap #num || insn ) */=0A= ! /* insn */=0A= ! idesc =3D emit_full16 (current_cpu, pc + 2,=0A= ! insn & 0x7fff, sc, 0, 0);=0A= ! /* trap */=0A= ! emit_full16 (current_cpu, pc, insn >> 16, sc + 3,=0A= ! 0, 0);=0A= ! }=0A= ! else=0A= ! {=0A= ! idesc =3D emit_full_parallel (current_cpu, pc, insn,=0A= ! sc, trace_p, profile_p);=0A= ! }=0A= cti_sc =3D sc + 1;=0A= sc +=3D 6;=0A= max_insns -=3D 6;=0A= }=0A= else=0A= {=0A= ! int up_count;=0A= !=20=0A= ! if (((insn >> 16) & 0xfff0) =3D=3D 0x10f0)=0A= ! {=0A= ! /* FIXME: No need to handle this sequentially i= f=0A= ! system calls will be able to execute after s= econd=0A= ! insn in parallel. ( trap #num || insn ) */= =0A= ! /* insn */=0A= ! idesc =3D emit_16 (current_cpu, pc + 2, insn & = 0x7fff,=0A= ! sc, 0, 0);=0A= ! /* trap */=0A= ! emit_16 (current_cpu, pc, insn >> 16, sc + 1, 0= , 0);=0A= ! up_count =3D 2;=0A= ! }=0A= ! else=0A= ! {=0A= ! idesc =3D emit_parallel (current_cpu, pc, insn, sc, 0);=0A= ! up_count =3D 3;=0A= ! }=0A= cti_sc =3D sc;=0A= ! sc +=3D up_count;=0A= ! max_insns -=3D up_count;=0A= }=0A= icount +=3D 2;=0A= pc +=3D 4;=0A= --Boundary_(ID_T+NRc+WdKWrVmW6NNJ/zcw)--