]> xenbits.xensource.com Git - osstest/rumprun.git/commitdiff
Fix mul64_32() for i386 clobbering CF
authorMartin Lucina <martin@lucina.net>
Tue, 13 Oct 2015 10:55:56 +0000 (12:55 +0200)
committerMartin Lucina <martin@lucina.net>
Tue, 13 Oct 2015 14:15:29 +0000 (16:15 +0200)
platform/hw/arch/x86/clock.c

index 4598f446bc99e67e72fafb8d062ee17562e26af3..664cf64fbbaa6f4c58b0b78019120be48ff6da2c 100644 (file)
@@ -125,9 +125,9 @@ mul64_32(uint64_t a, uint32_t b)
                "mov  %4,%%eax ; "  /* %eax = h                               */
                "mov  %%edx,%4 ; "  /* t1 = ((l * b) >> 32)                   */
                "mul  %5       ; "  /* %edx:%eax = (h * b)                    */
-               "add  %4,%%eax ; "
-               "xor  %5,%5    ; "
-               "adc  %5,%%edx ; "  /* %edx:%eax = (h * b) + ((l * b) >> 32)  */
+               "xor  %5,%5    ; "  /* t2 = 0                                 */
+               "add  %4,%%eax ; "  /* %eax = (h * b) + t1 (LSW)              */
+               "adc  %5,%%edx ; "  /* %edx = (h * b) + t1 (MSW)              */
                : "=A" (prod), "=r" (t1), "=r" (t2)
                : "a" (l), "1" (h), "2" (b)
        );