[Linuxppc-users] reasigning fp breaks the call chain
Buse Yilmaz
busey at vt.edu
Wed Sep 20 02:51:47 AEST 2017
Hello,
I'm working on a project that does migration between machines with
different ISAs (currently x86_64, Aarch64 and PowerPC64). The migration is
done with a compiler and runtime support based LLVM (3.7) that does stack
transformation. It generates binaries for all ISAs and resumes the
execution on the migrated architecture. For this purpose we record the
registers and walk the call chain to record any other information needed
such as callee-saved registers, live values and addresses that FP and SP
point to, CFA, TOC...etc. We enforce the usage of an FP. Then create the
same call chain on the destination architecture.
To test our stack transformation first we try it on the same architecture
assuming we do a migration from an architecture with ISA x to the machine
with the same ISA.. We get an architecture say PowerPC, divide its stack
into 2 and walk the call chain on the upper partuntil the leaf fuction is
hit, then switch to the lower part assuming this is the destination
architecture and rewrite the frames here.
To resume the execution when we switch to the lower part of the stack, we
jump to the beginning of the leaf function and attach FP and SP accordingly
(we already know the whole register values of this function as well as its
frame size) and load the register set with correct values.
We're able to walk the chain up on the destination and create all the call
frames, however the call chain itself is broken as soon as I switch to the
destination. To be more precise it's broken when I move the FP to point to
SP on the destination stack (this is how LLVM does it, FP points to the top
of the stack ust as SP does). So I'm left with some frames missing, no
crashes but the execution is not correctly performed.
I assume that the backchain is broken on destination since we resume
starting from the leaf function, at this point the callers don't have their
frames on the stack yet.
I wonder if creating frames on the destination in the reverse order (a.k.a
like a normal execution would do, filling the stack with frames starting
from the caller not the callee.
I'm looking forward your help. apologies for what I have described being
very abstract and long.
P.S. We observe this behavior on neither x86 nor ARM.
Thank you!
--
Buse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-users/attachments/20170919/9a622dff/attachment.html>
More information about the Linuxppc-users
mailing list