Architecture 04 Flashcards
What is the general form of memory addressing word in the x86 architecture?
disp (%reg1, %reg2, scale)
• disp is a constant integer (offset)
• reg1 is the base register of the operand
• reg2 is the index register of the operand
• scale can only be 1, 2, 4, 8
Show how you could use indirect mode addressing in the x86 architecutre
General: disp (%reg1, %reg2, scale)
Indirect mode: (%reg1)
Show how you could use direct mode addressing in the x86 architecutre
General: disp (%reg1, %reg2, scale)
Direct mode: disp
What is meant by AT&T syntax?
A convention for assembly languages, for example in AT&T syntax the destination address comes last:
• movq source, dest
What is the typical characteristic of a CISC instruction?
The instruction combines load of values and the arithmetic
What is meant by assembly calling convention?
A convention people agree on for assembly languages, declaring
• How arguments are passed
• How results are returned
• How registers may be used for storing intermediate values
What is the calling convention for C on x86-64 in terms of function arguments?
If
• A Function has N <= 6 arguments
• And all fit into 64 bits
Then the arguments are stored in the first N of
rdi rsi rdx rcx r8 r9
Additional (and longer than 64 bit) arguments go on the stack
What is the calling convention for C on x86-64 in terms of return value?
If return type fits in 64 fits, then it is returned in rax
What are the characteristics of a high level language?
- One to many translation (each statement corresponds to multiple machine level instructions)
- Hardware independence (Abstracts over underlying hardware)
- Application orientation (Designed to create application programs)
- General purpose (Not restricted to a specific task)
- Powerful abstractions (Complex tasks can be expressed succinctly)
What are the characteristics of a low level language?
- One to one translation (each statement correspons to one machine level instruction)
- Hardware dependence (Dependent on type of processor)
- Systems programming orientation (Can create software that directly controls hardware)
- Special purpose (Used when extreme control or efficiency is needed)
- Few abstractions (Forces programmer to construct abstractions)