From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24183 invoked by alias); 20 Jan 2004 04:57:56 -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 24176 invoked from network); 20 Jan 2004 04:57:54 -0000 Received: from unknown (HELO mail04.idc.renesas.com) (202.234.163.13) by sources.redhat.com with SMTP; 20 Jan 2004 04:57:54 -0000 Received: (from root@localhost) by guardian03.idc.renesas.com with id i0K4vhke018728; Tue, 20 Jan 2004 13:57:43 +0900 (JST) Received: from unknown [172.20.8.70] by guardian03.idc.renesas.com with SMTP id PAA18727 ; Tue, 20 Jan 2004 13:57:43 +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 <0HRR00GNBV478P@dnma01.rso.renesas.com>; Tue, 20 Jan 2004 13:57:44 +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 <0HRR007J4V47SH@dnma02.rso.renesas.com>; Tue, 20 Jan 2004 13:57:43 +0900 (JST) Date: Tue, 20 Jan 2004 04:57: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: <000801c3df12$cf9ec4c0$2569910a@tool.maec.co.jp> MIME-version: 1.0 Content-type: text/plain; charset=iso-2022-jp Content-transfer-encoding: 7BIT 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> <16396.25248.771893.16597@claire.transmeta.com> X-SW-Source: 2004-01/txt/msg00546.txt.bz2 > Ah hah! So this is about TRAP_SYSCALL. :-) > TRAP_SYSCALL is a simulator-only facility to simplify printf,exit,etc. Yes. It's only for executing a system call hook routine. The parallel execution is no problem if a trap is not for system calls(TRAP_SYSCALL etc.). A trap instruction doesn't need a result of second insn. (A trap is like a jump instruction.) A trap handler routine needs a result of second insn. A m32r_trap() also executes a trap handler routine. > 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 :-)] > the TRAP_SYSCALL trap cannot be paired with instructions > that set up inputs for the syscall ....(--;) The following patch is only for a trap in parallel. http://sources.redhat.com/ml/gdb-patches/2004-01/msg00497.html