From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7538 invoked by alias); 19 Jan 2004 23:05:40 -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 7521 invoked from network); 19 Jan 2004 23:05:37 -0000 Received: from unknown (HELO neon-gw.transmeta.com) (63.209.4.196) by sources.redhat.com with SMTP; 19 Jan 2004 23:05:37 -0000 Received: (from root@localhost) by neon-gw.transmeta.com (8.9.3/8.9.3) id PAA02245; Mon, 19 Jan 2004 15:05:26 -0800 Received: from mailhost.transmeta.com(10.1.1.15) by neon-gw.transmeta.com via smap (V2.1) id xma002232; Mon, 19 Jan 04 15:05:03 -0800 Received: from claire.transmeta.com (claire.transmeta.com [10.10.25.31]) by deepthought.transmeta.com (8.11.6/8.11.6) with ESMTP id i0JN56f02980; Mon, 19 Jan 2004 15:05:06 -0800 (PST) Received: (from dje@localhost) by claire.transmeta.com (8.11.6/8.11.6) id i0JN54c21929; Mon, 19 Jan 2004 15:05:04 -0800 From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16396.25248.771893.16597@claire.transmeta.com> Date: Mon, 19 Jan 2004 23:05:00 -0000 To: Kazuhiro Inaoka Cc: Andrew Cagney , gdb-patches@sources.redhat.com Subject: Re: [PATCH] fix trap in parallel for m32r-sim In-Reply-To: <002401c3de56$6dcfe240$2569910a@tool.maec.co.jp> 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> <002401c3de56$6dcfe240$2569910a@tool.maec.co.jp> X-SW-Source: 2004-01/txt/msg00534.txt.bz2 Kazuhiro Inaoka writes: > Hi Doug, > > I want to fix the following problem. > > test pattern is: > main() > { > asm("trap #0 || ldi r0,#1"); /* the same as exit() ? */ > > abort(); > } Ah hah! So this is about TRAP_SYSCALL. :-) TRAP_SYSCALL is a simulator-only facility to simplify printf,exit,etc. I gather you want r0 to be 1 before the trap is taken, violating standard parallel execution semantics: all inputs read before any outputs written. i.e. you want the trap to _read_ the value of r0 and get 1. This is different than the violation I refered to previously where the trap will _write_ the value of r0, say, before other insns have read their inputs. It seems like you're trying to fix a broken program by breaking (or at least hacking) the simulator. How about instead just having a rule that says the TRAP_SYSCALL trap cannot be paired with instructions that set up inputs for the syscall? This would be no different than trying to make asm ("add r1,r0 || ldi r0,#1"); // increment r1 by 1 work. It doesn't work because the `add' will read the value of r0 before the ldi has set it to 1. [apologies if I got the syntax wrong, haven't programmed m32r assembler in a while :-)] > 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.