This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Need help to modify the prologue and epilogue...


I am trying to modify the prologue and epilogue of the compiler...
The methods are ix86_expand_prologue() and ix86_expand_epilogue() ...
This the is new prologue and epilogue I want:
prologue:
<push return address>

PUSH EBP ;

MOV EBP, ESP

XOR [EBP+4], EBP ; [EBP+4] has return address and XOR encryptes it.

END of new Prologue

Therefore I want to encrypt my return address with the ebp register or
hard_frame_pointer_rtx after ebp is pushed onto the stack.
I cannot figure out how to execute this instruction
XOR [EBP+4], EBP
as to do so I need to put [EBP+4] location in a hard register.
for that I wrote this code:
if(frame_pointer_needed)
{
?? ? rtx ebp_plus, ebp, insn;
?? ?ebp_plus = gen_rtx_REG(Pmode, SI_REG); ? ? \\SI_REG is a hard
register, please suggest if I am wrong at this step.
ebp = gen_rtx_REG(Pmode, BP_REG);
emit_move_insn(ebp_plus, plus_constant(hard_frame_pointer_rtx, 4));
?? ? ??insn = emit_insn(gen_xorsi3(ebp_plus, ebp_plus, ebp));
}
In the epilogue I need to execute the same instruction:
XOR [EBP+4], EBP
in the beginning.
When I include these changes and try to build the compiler, it shows
some error and stops.
It shows some error in i386.md file which was not there when I try to
build the compiler without
my changes in it.
Kindly help me with this.
Thank You

--
Vaibhav Shrimali


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]