vendredi 26 octobre 2018

multiple assembly instruction using asm volatile in c code

I need to modified an random number generator using rdrand(only), It implemented in c code as follows.

uint64_t _rdrand(void)
{
        uint64_t r;
            __asm__ volatile("rdrand %0\n\t" : "=r"(r));
                return r;
}

Now i need to modify such that it returns only if carry flag is set. (According to rdrand documentation).I think it can be implimented by jc instruction,but don't know how to use inside __asm__ volatile.please help me.




Aucun commentaire:

Enregistrer un commentaire