Page 126 - ARM 64 Bit Assembly Language
P. 126
112 Chapter 4
b. shift a left by one bit, storing the result in b,
c. add b to a,and
d. subtract b from a.
4.10. The C standard library provides the openat() function, which is documented in
section two of the Linux manual pages. This function is a very small “wrapper”
to allow C programmers to access the openat() system call. Assembly program-
mers can access the system call directly. In arm64 Linux, the system call number
for openat() is 56. The Linux system calls can be found on a Linux system in:
/usr/include/asm-generic/unistd.h. Write the arm64 assembly instructions
and directives necessary to make a Linux system call to open a file named input.txt
for reading, without using the C standard library. In other words, write the assembly
equivalent to: openat(-100,"input.txt",O_RDONLY); using the svc instruction.