Re: how to set some value at a memory location in stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ian I have one query.
I can use a hard register for this task. But will it allow me to
modify the memory location, between original return address and saved
frame pointer, stored in it?
I think it will be just saved in the "saved registers" area of stack.
The assembly conversion of the prologue I need is:

POP EAX		        ; new prologue start
PUSH EAX		; unencrypted return address
PUSH EAX		; duplicate return address
PUSH EBP		; standard prologue
MOVE EBP, ESP
XOR [EBP+4], EBP  	; [EBP+4] has EIP and XOR encryptes ret addr(EIP)

I want to know the function which allows me to write a value at a
memory address specified by a variable (generated by gen_rtx_MEM).
I thought force_reg is the one. Now, can I use ebx/ecx/...etc register
for the purpose.
OR will copy_to_mode_reg() function do the job?
OR is there any other function to do the job?


On Wed, Apr 14, 2010 at 10:40 AM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote:
> Vaibhav Shrimali <vaibhav.shrimali@xxxxxxxxx> writes:
>
>> I am performing this task in the prologue in the section where the
>> hard frame pointer is pushed on the stack.
>
> This is after register allocation, so you can not use force_reg.
>
>> If not, please tell me how and where can I allocate the register and
>> then use my code accordingly.
>
> You have to figure out a hard register to use.  It should be safe to
> use any call used register in the prologue, as long as it is not being
> used for anything else in the prologue.  If you want this to be
> generally useful, watch out for the regparm attribute.  The prologue
> code is full of examples of using registers; read it and understand
> what it is doing.
>
> Ian
>



-- 
Vaibhav Shrimali
BTech(ICT), DA-IICT
Gandhinagar


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux