Input / Output Flashcards
How does a program running in EL0 do I/O?
It makes a system call, generating an exception by using the svc instruction, with the request value in x8
(T/F) All peripheral devices are represented as file
True
What are the service requests and their corresponding values?
openat - 56
close - 57
read - 63
write - 64
Where is the return value of a system call stored?
In x0
What is the C function to open a file?
openat(int dirfd, const char *pathname, int flags, mode_t mode);
What is the C function to read from a file?
read(int fd, void *buf, unsigned long n);
What is the C function to write to a file?
write(int fd, void* buf, unsigned long n);
How is the buffer base calcultated?
add buf_base, x29, buf_s
What is the value of AT_FDCWD?
-100