[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve first chapter #27

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Improve first chapter #27

wants to merge 8 commits into from

Conversation

0xAX
Copy link
Owner
@0xAX 0xAX commented Jun 9, 2024

This PR provides significant rework for the first chapter.

@0xAX 0xAX requested a review from klaudiagrz as a code owner June 9, 2024 11:32
@0xAX 0xAX self-assigned this Jun 9, 2024
@0xAX 0xAX force-pushed the chapter-1-update branch 2 times, most recently from 42a39fc to ce606fa Compare June 16, 2024 15:49
hello/README.md Outdated Show resolved Hide resolved
@Deckloins
Copy link

Hi ! I started working on rewording the first article, but then saw you already had a big head start.
If you want we could work together to fine-tune the translation

content/asm_1.md Outdated Show resolved Hide resolved
content/asm_1.md Outdated Show resolved Hide resolved
content/asm_1.md Outdated Show resolved Hide resolved
content/asm_1.md Outdated Show resolved Hide resolved
content/asm_1.md Outdated Show resolved Hide resolved
content/asm_1.md Outdated Show resolved Hide resolved
- `rsi` - Used to pass `2nd` argument to a function.
- `rdx` - Used to pass `3rd` argument to a function.

There is more details related to the Linux `x86_64` calling conventions but the description above should be enough for now. Knowing the meaning and the way of use of these registers we can return to the code. What do we need to write a `hello world` program? Usually we just pass a `hello world` string to a library function like [printf](https://en.wikipedia.org/wiki/Printf) or so. But these functions usually goes from a [standard library](https://en.wikipedia.org/wiki/Standard_library) of a programming languages we are using. Assembly does not have a standard library. What to do in this case? Well, we have at least the two following approaches:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There is more details related to the Linux `x86_64` calling conventions but the description above should be enough for now. Knowing the meaning and the way of use of these registers we can return to the code. What do we need to write a `hello world` program? Usually we just pass a `hello world` string to a library function like [printf](https://en.wikipedia.org/wiki/Printf) or so. But these functions usually goes from a [standard library](https://en.wikipedia.org/wiki/Standard_library) of a programming languages we are using. Assembly does not have a standard library. What to do in this case? Well, we have at least the two following approaches:
This knowledge about Linux `x86_64` calling conventions should be enough for now. Knowing the meaning and the usage of the registers, we can return to the code. What do we need to write a `hello world` program? Usually, we just pass a `hello world` string to a library function like [printf](https://en.wikipedia.org/wiki/Printf). But this function usually goes from a [standard library](https://en.wikipedia.org/wiki/Standard_library) of a programming language we use. Assembly does not have a standard library. What to do in this case? Well, we have at least two options:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function usually goes from...

I don't like "goes from", can we replace it with another verb?

content/asm_1.md Outdated Show resolved Hide resolved
content/asm_1.md Outdated Show resolved Hide resolved
- Link our assembly program with C standard library and use [printf](https://man7.org/linux/man-pages/man3/printf.3.html) or any other function that may help us to write a text to the [standard output](https://en.wikipedia.org/wiki/Standard_streams).
- Use the operating system API

We will go through the second way. Each operating system provides an interface that a user level application may use to interact with the operating system. Usually the functions of this API are called `system calls`. Linux kernel also provides set of system calls to interact with it. The full list of system calls with the respective numbers for the Linux `x86_64` could be found [here](https://github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscall_64.tbl). Looking in this table, we may see:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's good to mention why we do not explain the first option?

0xAX added 7 commits July 17, 2024 17:04
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
@0xAX 0xAX force-pushed the chapter-1-update branch 3 times, most recently from eb6f132 to 4b8ead1 Compare July 17, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants