cset.S 525 B

1234567891011121314151617181920212223242526272829
  1. /* https://cirosantilli.com/linux-kernel-module-cheat#arm-cset-instruction */
  2. #include <lkmc.h>
  3. LKMC_PROLOGUE
  4. /* Test values. */
  5. mov x19, 0
  6. mov x20, 1
  7. /* eq is true, set x21 = 1. */
  8. cmp x19, x19
  9. cset x21, eq
  10. LKMC_ASSERT_EQ(x21, =1)
  11. /* eq is false, set x21 = 0. */
  12. cmp x19, x20
  13. cset x21, eq
  14. LKMC_ASSERT_EQ(x21, =0)
  15. /* Same for ne. */
  16. cmp x19, x19
  17. cset x21, ne
  18. LKMC_ASSERT_EQ(x21, =0)
  19. cmp x19, x20
  20. cset x21, ne
  21. LKMC_ASSERT_EQ(x21, =1)
  22. LKMC_EPILOGUE