1.List th nams of th 16 gnral purpos 64 bit rgistrs for th Intl x68_64 architctu
ID: 3887368 • Letter: 1
Question
1.List th nams of th 16 gnral purpos 64 bit rgistrs for th Intl x68_64 architctur.
2.What nasm kyword is usd to mak an assmbly function or labl visibl to xtrnal C cods?
3.What nasm kyword is usd to mak an xtrnal C function or labl visibl to an assmbly cod?
4. What x86_64 instruction is usd to call an xtrnal C function?
5. What x86_64 instruction is usd to call an assmbly function?
6. xcutabl assmbly instructions ar placd in th __________ sgmnt of an assmbly
languag program.
7. Data/variabl dclaration instructions ar placd in th __________ sgmnt of an assmbly languag program.
8.Which gnral purpos rgistrs ar not guarantd (by convntion) to rtain thir prior valus aftr a function call?
Explanation / Answer
1)
RAX - Register A Extended
RBX - Register B Extended
RCX - Register C Extended
RDX - Register D Extended
RBP - Register Base Pointer
RSI - Register Source Index
RDI - Register Destination Index
RSP - Register Stack Pointer
R8 - Register 8
R9 - Register 9
R10 - Register 10
R11 - Register 11
R12 - Register 12
R13 - Register 13
R14 - Register 14
R15 - Register 15
2)
In order to make an assembly function or label visible to external c program then, you must declare the function name global in the assembly code, and put a '_' in front of its name.
example:
segment .text
global _fun
_fun: first instruction of function
so the keyword global is used to mak an assmbly function or labl visibl to xtrnal C cods.
3)
extern is the keyword used to make an external C function or label visible to an assembly code
example:
extern _printf
4)
inorder to call an extenal c function from assembly first we have to define them in extern section then by using
call instruction we can call an external c function.
example:
.extern _fun
call _fun
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.