[ASSE] Computer Architecture & Assembly Language¶
Repository & Deadlines¶
Deadline: Fri, December 21 2018 23:59.
You must push your code before the deadline to:
You must change LOGIN with yours. You have to upload your ssh-key to accounts.cri.epita.net.
The repositories are not available yet, but you can still start working.
You can send questions on the newsgroup: labos.lse on news.epita.fr, with the tag: [ASM][TP]. Any question without this tag will be ignored. You must as usual respect the basic rules for sending a news/email.
General structure of your work:
$ find . . ./libstring ./lists ./cat
- all your code must be in x86_64 assembly language, and compiled with gcc.
- you must use AT&T syntax as seen in courses.
- you should export your function correctly, don’t have symbols for inner labels in your code (hint: .L).
- no function should unnecessarly be exported.
- error messages must be on the standard error output
- you can’t use any global or static data.
- string literals must be stored in .rodata.
- Each folder should contain a Makefile that is creating the asked binaries.
- Your assembly files should finish by .S and be compiled with gcc, as if you compile C code.
- You need to respect the calling conventions used on linux for all your exported functions [calling-conventions].
For this exercise you need to create a shared library libstring.so that contains the following functions:
char *my_strchr(const char *s, int c); char *my_strcpy(char *dest, const char *src); size_t my_strlen(const char *s);
For all the functions, see their respective man pages.
For this exercise you need to create a shared library liblists.so that
implement the functions contained inside
Authorized functions: malloc(3), free(3)
For this exercise, you will have to code a small program that you already all know and use: cat.
You will need to use the libc for this, no need to call the syscalls by hand.
Here is some examples of the usage for your program:
$ echo "this is an example" > foo $ echo "this is another example" > bar $ ./cat < foo this is an example $ ./cat bar this is another example $ ./cat foo bar this is an example this is another example $ ./cat foo non-exists this is an example cat: unable to open non-exists: No such file or directory $