Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Waqas, Muhammad Q35. How to declare the following type of variables in x64 assem

ID: 3843237 • Letter: W

Question

Waqas, Muhammad Q35. How to declare the following type of variables in x64 assembly language? The variable age is type word and is initialized to 22. of Q36. Which of the following three sections of an assembly program in nasm has the source code? data bss, ext? Q37. What is the purpose of the following: Rax Q37. When a syscall is called which register must have the syscall number? Q38, which syscall is a must for every program? Why? Q39. What is the difference in using register with or without the square brackets 0? Q40. How is the constant Pl with a value of 3.1459 declared in x64 assembly language?

Explanation / Answer

35.DW   Define Word   allocates 2 bytes

age       DW   22

36.Source code is presenr in .bss section.

37.mov Rbx, Rax means Move source to destination

38.The architecture of most modern processors, with the exception of some embedded systems, involves a security model. For example, the rings model specifies multiple privilege levels under which software may be executed: a program is usually limited to its own address space so that it cannot access or modify other running programs or the operating system itself, and is usually prevented from directly manipulating hardware devices (e.g. the frame buffer or network devices).

However, many normal applications obviously need access to these components, so system calls are made available by the operating system to provide well defined, safe implementations for such operations. The operating system executes at the highest level of privilege, and allows applications to request services via system calls, which are often initiated via interrupts. An interrupt automatically puts the CPU into some elevated privilege level, and then passes control to the kernel, which determines whether the calling program should be granted the requested service. If the service is granted, the kernel executes a specific set of instructions over which the calling program has no direct control, returns the privilege level to that of the calling program, and then returns control to the calling program.

39. When you use [a], then you refer to the value at the place where a points to.For example, if a is F5B1, then [a] refers to the address F5B1 in RAM.

Labels are addresses,i.e values like F5B1.

Values stored in registers do not have to be referenced to as [reg] because registers do not have addresses.In fact, registers can be thought of as immediate values.

40. The EQU directive is used for defining constants.
CONSTANT_NAME EQU expression

ex. PI equ 50

mov ecx, PI
cmp eax, P