0

Based on the very famous textbook provided by CMU, Computer System:A Programmer's Perspective (CSAPP)...

The most frequent instruction is movq. In this book, movq x y means copying data from x to y. enter image description here

however, after I refer the https://www.felixcloutier.com/x86/movq, a X86 instruction set documentation, it seems that movq x y should mean copying data from y to x.... Actually, not only this website, but also most other webistes show that movq x y means copying from y to x enter image description here

I am not good at assembly language, but that really confuses me.... Can someone help me figure out which on is true...whhich on is picked by C langugage?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574

1 Answers1

1

There is only one movq "direction" as you call it, but there are two assembly flavors, the Intel assembly standard and the AT&T assembly standard, and one of the things they differ on is the order of the operands.

So read and understand the instruction definition and then translate the call to the flavor of assembly you're using.

Blindy
  • 65,249
  • 10
  • 91
  • 131