Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[Q] Android emulator (div by zero)

$
0
0
I got intresting situation with following code:

Code:

    static void DivideByZero() {
      // volatile to prevent compiler optimizations.
      volatile float zero = 0.0f;
      volatile float result __attribute__((unused)) = 123.0f / zero;
    }
  DivideByZero();
  int raised = fetestexcept(FE_DIVBYZERO | FE_OVERFLOW);
  ASSERT_TRUE((raised & FE_DIVBYZERO) != 0);

When I run my qemu device witout KVM support I got following results:
command line:android -avd x86 -qemu
Code:

FE_DIVBYZERO !=0; //and it's ok
But when I run same source without KVM support:
command line:android -avd x86 -qemu -disable-kvm
Code:

FE_DIVBYZERO ==0; //and it's not ok
As I understand this situation, it's happens because in mxcsr register bit (div by zero) is not setted, by why this bit is not setted i don't understand. Any ideas?

System: Linux

Viewing all articles
Browse latest Browse all 3614

Trending Articles



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