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]

Changing Stack Frame in x86...


I've having some trouble making some modifications to GCC.  I'm compiling
for the x86 architecture running under RedHat Linux 7.0 using GCC 2.95.3.
Basically, what I want to do is to modify the stack frame generation so that
at the beginning of each function, an extra 32 bit value is stored on the
stack, right next to the return address.  I have modified the function
prologue and epilogue code generation routines so that this new value is
pushed onto the stack before the function's stack frame is setup, so that
this new value is stored right next to the return address.  The epilogue
pops this new value off right before generating the return instruction.  The
problem is that this screws up passing parameters into functions, as the
offsets from %esp generated by the compiler are now wrong since I've pushed
an extra value onto the stack.  So, basically I need to modify GCC so that
it "sees" a 8 byte return address instead of a 4 byte return address, as I'm
pushing this new value next to the return address at the very beginning of
every function.  I've been playing with the stack frame setup macros in
i386.h but am not having much luck.  Could someone who is more familiar with
how to do such a thing in GCC tell me what I have to do to make this happen?
Thanks...

-j6

-------------------------------------------------------------
Jeffrey A. Six
                                   jeffsix@thecouch.ncsc.mil
US Department of Defense

  "Staff are requested not to use the eye patches in this
   first-aid kit to impersonate pirates or other characters.
   They are for medical use only."


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