From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13106 invoked by alias); 24 Jan 2011 08:04:23 -0000 Received: (qmail 13088 invoked by uid 22791); 24 Jan 2011 08:04:20 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 Jan 2011 08:04:15 +0000 Received: (qmail 29267 invoked from network); 24 Jan 2011 08:04:13 -0000 Received: from unknown (HELO ?192.168.0.101?) (yao@127.0.0.2) by mail.codesourcery.com with ESMTPA; 24 Jan 2011 08:04:13 -0000 Message-ID: <4D3D3278.5050602@codesourcery.com> Date: Mon, 24 Jan 2011 13:22:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Richard Earnshaw CC: gdb-patches@sourceware.org, julian@codesourcery.com Subject: Re: [patch] Fix PR tdep/12352: Handle str pc, [Rd, #imm] in displaced stepping References: <4D1A1343.8020204@codesourcery.com> <4D3AF29E.3020708@buzzard.freeserve.co.uk> In-Reply-To: <4D3AF29E.3020708@buzzard.freeserve.co.uk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00457.txt.bz2 On 01/22/2011 11:07 PM, Richard Earnshaw wrote: > On 28/12/10 16:41, Yao Qi wrote: >> When I read arm-tdep.c:copy_ldr_str_ldrb_strb, I feel pretty hard to >> understand two lines of code, >> >> dsc->modinsn[0] = 0xe58ff014; /* str pc, [pc, #20]. */ >> dsc->modinsn[1] = 0xe59f4010; /* ldr r4, [pc, #16]. */ > > Hmm, looks like a rather convoluted way of moving the PC into R4. > Julian, I think this patch was yours... can you remember why "MOV R4, > PC" wasn't sufficient? > IIUC, these two instructions together with 'sub r4, r4, pc' are used to calculate the offset of 'str pc ADDR', which is 8 or 12(implementation-dependent, but consistent for a given device). AFAIK, 'mov r4, pc' doesn't help. -- Yao (齐尧)