From 2c298fe2b458c76dcde6f33ddcbdec1ee40e32ab Mon Sep 17 00:00:00 2001 From: tomoron Date: Sat, 29 Mar 2025 20:35:47 +0100 Subject: [PATCH] add README --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4817d3f --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# libasm +## Why I did this project +I wanted to do this project for a while because I am interested in low level programming +and assembly seemed very interesting. +I had a lot of fun doing it, learning about function calling conventions, x86_64 architecture +and other things. + +## How to compile it +To compile the project, you'll need `nasm` and `make`. Optionally, if you want to compile the tests, +you will need `clang`. +Once you have these requirements, simply run the command `make` and the project should compile. +The result is a library that you can add to your project with `-L -lasm`, folder being the folder where the file `libasm.a` is located + +## test the project +for every function asked for by the subject, there is a testing function in the file test.c +To compile the tests run the command `make tests`. Then run the resulting executable with `./test` + +## Useful documentation +While doing this project, since I had never programmed in x86_64 assembly before, I had to find some basic documentation. +I mostly had trouble with remembering the order of the functions parameters in the registers, I kept going back to +[this stackoverflow thread](https://stackoverflow.com/questions/13901261/calling-assembly-function-from-c) +provided the order I needed. And in this thread I found information about the System V calling convention. + +During this project, I also needed to make system calls. To their parameters and numbers, I used [this page](https://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/) which has a table of all the system calls. + +Finally I also used [this website](https://www.felixcloutier.com/x86/) to find more info about some instructions I didn't understand. It was also a useful resource for finding the appropriate jump instructions based on my needs.