Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error: bad register name `%rax'
- Error: bad register name `%rbx'
- #include <iostream>
- #include <cstdlib>
- #include <stdint.h>
- void read(void)
- {
- uint64_t rax = 0, rbx = 0;
- __asm__ __volatile__ (
- /* read value from rbx into rbx */
- "movq %%rbx, %0;n"
- /* read value from rax into rax*/
- "movq %%rax, %1;n"
- /* output args */
- : "=r" (rbx), "=r" (rax)
- : /* no input */
- /* clear both rdx and rax */
- : "%rbx", "%rax"
- );
- /* print out registers content */
- std::cout << "RAX = " << rax << "n";
- std::cout << "RBX = " << rbx << "n";
- }
- int main(int argc, char **argv)
- {
- read();
- return 0;
- }
- : "%rbx", "%rax"
- : "rbx", "rax"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement