On Monday 03 September 2012 23:13:41 Sven Eckelmann wrote: [...]
And the both version of the variable_test_bit seem to return 0 and -1 (at least my quick interpretation of the asm listings).
Just checked a asm reference and noticed that I remembered sbb wrong. The calculation behind it is: op2 - (op1 + CF). I thought that it was: op2 - op1 + CF
And I think I confused everyone right now. My original sentence should have said "seem to return 0 and 1" and not something about "-1".
The variable_test_bit for non-boot is implemented in asm and uses "btc" to check for the bit (that info is stored in CF as 0 for "not set" and 1 for "set"). sbb is used to store this information in the destination variable by substracting the original content of the variable from itself + also substracting the content of CF from it. That's why we get a -1 as result of test_bit on kvm.
Great finding and excellent patch.
Kind regards, Sven