Advertisement
Guest User

Untitled

a guest
Jan 14th, 2014
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Error: bad register name `%rax'
  2. Error: bad register name `%rbx'
  3.  
  4. #include <iostream>
  5. #include <cstdlib>
  6. #include <stdint.h>
  7.  
  8. void read(void)
  9. {
  10. uint64_t rax = 0, rbx = 0;
  11. __asm__ __volatile__ (
  12. /* read value from rbx into rbx */
  13. "movq %%rbx, %0;n"
  14. /* read value from rax into rax*/
  15. "movq %%rax, %1;n"
  16. /* output args */
  17. : "=r" (rbx), "=r" (rax)
  18. : /* no input */
  19. /* clear both rdx and rax */
  20. : "%rbx", "%rax"
  21. );
  22.  
  23. /* print out registers content */
  24. std::cout << "RAX = " << rax << "n";
  25. std::cout << "RBX = " << rbx << "n";
  26.  
  27. }
  28.  
  29. int main(int argc, char **argv)
  30. {
  31. read();
  32.  
  33. return 0;
  34. }
  35.  
  36. : "%rbx", "%rax"
  37.  
  38. : "rbx", "rax"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement