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

Confusing Inline Assembly

$
0
0
static inline void
insw(int port, void *addr, int cnt)
{
    asm volatile("cld\n\trepne\n\tinsw"
             : "=D" (addr), "=c" (cnt)
             : "d" (port), "0" (addr), "1" (cnt)
             : "memory", "cc");
}

Hey guys, I am feeling kinda confused about this code snippet while I was reading the code. I was wandering cnt looks like a loop counter, why it is not stored into ECX straightly but use "1" as input constrain. Seems like we can save one more register. I am new to this area, leave me few more steps if I made any newbie mistake. Cheers.


Viewing all articles
Browse latest Browse all 22015

Trending Articles



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