From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32259 invoked by alias); 16 May 2011 17:19:43 -0000 Received: (qmail 32246 invoked by uid 22791); 16 May 2011 17:19:42 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_SOFTFAIL,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate1.uk.ibm.com (HELO mtagate1.uk.ibm.com) (194.196.100.161) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 May 2011 17:19:27 +0000 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p4GHJHlI000842 for ; Mon, 16 May 2011 17:19:17 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p4GHJGHm2224380 for ; Mon, 16 May 2011 18:19:16 +0100 Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p4GHJGYc032044 for ; Mon, 16 May 2011 11:19:16 -0600 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p4GHJFd1032039; Mon, 16 May 2011 11:19:15 -0600 Message-Id: <201105161719.p4GHJFd1032039@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 16 May 2011 19:19:15 +0200 Subject: Re: [try 2nd 4/8] Displaced stepping for Thumb 16-bit insn To: yao@codesourcery.com (Yao Qi) Date: Mon, 16 May 2011 17:19:00 -0000 From: "Ulrich Weigand" Cc: gdb-patches@sourceware.org In-Reply-To: <4DCA89BE.9020804@codesourcery.com> from "Yao Qi" at May 11, 2011 09:06:06 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-05/txt/msg00363.txt.bz2 Yao Qi wrote: > In my new patch, there are three different cases to handle POP instruction, > 1. register list is full, no free register. The code sequence I am > using is like > > POP {r0, r1, ...., r6}; > POP {r7}; The above can use just a single POP {r0, ..., r7}, can't it? > MOV r8, r7; > POP {r7}; > > after execution of this sequence, PC's value is stored in r7, and r7's > value is stored in r8. In cleanup, we can set PC, r7, and r8 accordingly. > > 2. register list is not full, and not empty. In this case, we scan the > code to find a free register, rN. Run the follow code sequence, > > POP {rX, rY, ...., rZ}; > POP {rN}; > > After execution of this sequence, PC's value is stored in rN. In > cleanup, we can set PC from rN. Have you looked at how the ARM case does it? There, we still have just a single POP { r0, ..., rN } that pops the right number of registers, and then the cleanup function (cleanup_block_load_pc) reshuffles them. It seems to me we could do the same (and actually use the same cleanup function) for the Thumb case too ... > 3. register list is empty. This case is relative simple. > > POP {r0} > > In cleanup, we store r0's value to PC. If we used cleanup_block_load_pc, this would handle the same case as well. (Unfortunately, handling case 1 the same way looks somewhat difficult, since cleanup_block_load_pc would expect the PC in register r8 ...) > +cleanup_pop_pc_16bit(struct gdbarch *gdbarch, struct regcache *regs, > + struct displaced_step_closure *dsc) One more space before ( ... > + else /* Cleanup procedure of case #2 and case #3 can be unified. */ > + { > + int rx = 0; > + int rx_val = 0; > + > + if (dsc->u.block.regmask) > + { > + for (rx = 0; rx < 8; rx++) > + if ((dsc->u.block.regmask & (1 << rx)) == 0) > + break; > + } > + else > + rx = 0; (This is irrelevant if we decide to use cleanup_block_load_pc, but: the "if (dsc->u.block.regmask)" and "else rx = 0" are superfluous, since the for loop will terminate with rx == 0 anyway if regmask is zero.) Thanks, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com