- /* Pop EBP and the return address */
- new_ctx->SC_ESP = ctx->SC_EBP + (2 * sizeof (gpointer));
- /* we substract 1, so that the IP points into the call instruction */
- new_ctx->SC_EIP = *((guint64 *)ctx->SC_EBP + 1) - 1;
- new_ctx->SC_EBP = *((guint64 *)ctx->SC_EBP);
+ if (omit_fp) {
+ /* Pop frame */
+ new_ctx->rsp += (ji->used_regs >> 16) & (0x7fff);
+ new_ctx->SC_EIP = *((guint64 *)new_ctx->rsp) - 1;
+ /* Pop return address */
+ new_ctx->rsp += 8;
+ }
+ else {
+ /* Pop EBP and the return address */
+ new_ctx->SC_ESP = ctx->SC_EBP + (2 * sizeof (gpointer));
+ /* we substract 1, so that the IP points into the call instruction */
+ new_ctx->SC_EIP = *((guint64 *)ctx->SC_EBP + 1) - 1;
+ new_ctx->SC_EBP = *((guint64 *)ctx->SC_EBP);
+ }