how to set some value at a memory location in stack
Ian Lance Taylor
Fri Apr 16 08:35:00 GMT 2010
Vaibhav Shrimali <email@example.com> writes:
> 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.
Look at the generated code and see what is wrong.
It's very hard for us to answer a general question like "tell me what
is wrong with this code." We have a somewhat better chance of
answering a specific question like "this code produces X and I want
> On Thu, Apr 15, 2010 at 7:41 PM, Ian Lance Taylor <firstname.lastname@example.org> wrote:
>> Vaibhav Shrimali <email@example.com> 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, SRC2));
>>> So I checked and I can generate a register such that:
>>> rtx ebp_reg = gen_rtx_REG(Pmode, BP_REG);
>>> this would be a hard register.
>>> rtx ebp_plus = 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. The dump files
>> will show you the generated RTL.
> Vaibhav Shrimali
> BTech(ICT), DA-IICT
More information about the Gcc-help