From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28719 invoked by alias); 16 Apr 2010 04:56:50 -0000 Received: (qmail 28709 invoked by uid 22791); 16 Apr 2010 04:56:49 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SARE_MSGID_LONG45 X-Spam-Check-By: sourceware.org Received: from mail-gw0-f47.google.com (HELO mail-gw0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Apr 2010 04:56:45 +0000 Received: by gwb17 with SMTP id 17so662325gwb.20 for ; Thu, 15 Apr 2010 21:56:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.126.69 with HTTP; Thu, 15 Apr 2010 21:56:22 -0700 (PDT) In-Reply-To: References: From: Vaibhav Shrimali Date: Fri, 16 Apr 2010 05:44:00 -0000 Received: by 10.91.58.11 with SMTP id l11mr723619agk.0.1271393802833; Thu, 15 Apr 2010 21:56:42 -0700 (PDT) Message-ID: Subject: Re: how to set some value at a memory location in stack To: Ian Lance Taylor Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2010-04/txt/msg00168.txt.bz2 Hey Ian, I have been executing the code all this time. But apparently it was generating segmentation fault error. I configured the compiler with --disable-libssp option to disable the stack protector. Also I modified the hard frame pointer offset in the compute_frame_layout() method. But still it is showing segmentation fault. On Thu, Apr 15, 2010 at 7:41 PM, Ian Lance Taylor wrote: > Vaibhav Shrimali writes: > >> Thanks for all your help so far. I now think I am closer to my goal. >> In order to execute : >> XOR [EBP+4], [EBP] >> after executing : >> PUSH EBP >> >> in the prologue, I need to use : emit_insn (gen_xorsi3 (DESTREG, SRC1, S= RC2)); >> So I checked and I can generate a register such that: >> rtx ebp_reg =3D gen_rtx_REG(Pmode, BP_REG); >> this would be a hard register. >> rtx ebp_plus =3D gen_rtx_PLUS(Pmode, ebp_reg, 4); >> >> so now executing :- >> >> emit_insn (gen_xorsi3 (ebp_plus, ebp_plus, ebp_reg)); >> >> I dont know if ebp_plus would be converted to [XOR+4] or not, although >> it is derived from the hard register ebp_reg. >> >> If I am wrong in this approach, please correct me. > > At some point you have to try it and see what happens. =A0The dump files > will show you the generated RTL. > > Ian > --=20 Vaibhav Shrimali BTech(ICT), DA-IICT Gandhinagar