Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22016

Explanation of Asm code

$
0
0

The following GCC inline asm is taken from LuaJit's coco library. Can someone provide a line by line explanation of what it does?

static inline void coco_switch(coco_ctx from, coco_ctx to)
{
  __asm__ __volatile__ (
    "movl $1f, (%0)\n\t""movl %%esp, 4(%0)\n\t""movl %%ebp, 8(%0)\n\t""movl 8(%1), %%ebp\n\t""movl 4(%1), %%esp\n\t""jmp *(%1)\n""1:\n"
    : "+S" (from), "+D" (to) : : "eax", "ebx", "ecx", "edx", "memory", "cc");
}

Thanks


Viewing all articles
Browse latest Browse all 22016

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>