How to Write Loops and Function Calls in ARM 64-Bit Assembly

How to Write Loops and Function Calls in ARM 64-Bit Assembly

Low Level Learning

3 года назад

15,432 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Dj
Dj - 24.09.2023 12:11

For those trying to learn assembly to write programs on AArch64 Macs, here's a few points
- Syscall numbers are different. Check syscall.h header file. Exit is 1, write is 4.
- ldr X1, =message didn't work for me, but adr X1, message did.
- You should also add .p2align 2. Maybe after .global.
- Sections work differently, you need to write .section __TEXT,__text (segment name, section name).
- You can compile using as and link using ld, and by default it can pick up _main as the entry point, where you can also simply specify the return code in X0/W0 register

Ответить
Armen Ros
Armen Ros - 07.04.2023 10:12

great video

Ответить
Yonah Citron
Yonah Citron - 18.02.2023 22:26

Would love more arm tutorials!! 😍

Ответить
Richard Vrsnik
Richard Vrsnik - 10.02.2023 00:18

There is nothing near as good describing Aarm64 like this video.. Please go on. For me who knows Z80 is little confusing to use Link register and not the stack as i am little worried what will do function call within function call. I am thinking of LDR some_memory, link register and LDR linkregister from memory and then ret on the end of function. Or create poor man manual stack, however there may be better way
Great job

Ответить
Aqif Montana
Aqif Montana - 06.02.2023 17:34

Hello Bro , how are you ? Can you please help me to convert a simple c++ program to arm64. Ive tried everything but i just don't understand it. Thanks!

Ответить
Casey Hynick
Casey Hynick - 27.07.2022 03:51

Great video, thanks for putting this series together. Looking forward to seeing more of your videos on ARM64.

Ответить
Mahmoud Ammar
Mahmoud Ammar - 08.06.2022 17:37

why did you stop posting more videos?

Ответить
saudgl
saudgl - 26.02.2022 01:17

Thank you so much🙏 Bless you, y

Ответить
Xiler
Xiler - 11.02.2022 04:46

179 likes and 0 dislikes. Now that's a perfect ratio.

Ответить
Rohan Kumar
Rohan Kumar - 23.12.2021 10:00

Nice tutorials! Waiting for the upcoming videos.

Ответить
Diego Naya
Diego Naya - 20.10.2021 23:59

Thanks

Ответить
BK Sharif
BK Sharif - 20.10.2021 19:33

Nice work keep it up!

Looking forward for stack video!

Ответить
David McCormack
David McCormack - 26.09.2021 00:58

Your videos are great. I found your channel when looking for ARM64 info with a view to writing shellcode for Windows ARM (I work in cybersecurity). It would be cool if you could do a video on making syscalls to the Windows kernel on ARM…just sayin’. But I also have a question about this video. As you know, x86 has no equivalent to the link register so ‘call’ pushes the return address onto the stack. Even though this is slower than having a link register, one benefit is that the programmer doesn’t need to worry about the link register getting modified. I notice in your hello_world function that you don’t push the link register value before the svc 0 and pop it afterwards. Does the Linux ARM system call ABI guarantee to preserve the link register or did you just get lucky?

Ответить
Gregory Fenn
Gregory Fenn - 25.07.2021 16:08

On my system (uname -r is "5.11.0-1015-raspi") note that 'exit' is a special linux function defined to both exit a program and flush any io streams. So I would not recommend using exit as a label in your ASM code.

Ответить
gc inko
gc inko - 08.05.2021 22:30

Isn't better to use subs and branch if not zero without first cmp and branch instruction?

Ответить
Martin
Martin - 27.04.2021 03:39

I have a maybe stupid question. If i
learn a more accessible architecture, like x86, where much more tutorials exist, will it be easier to then apply that knowledge to risk? will the Arm32 tutorials also help me?

Besides that - great videos! nice to listen to.

Ответить
John Google
John Google - 21.03.2021 23:46

Very nice video. How does the keywords "_start, loop, hello_world, exit" work? do they get translated into pointing to static memory adresses?

Ответить
Billzo Aiken
Billzo Aiken - 07.03.2021 18:02

Very excited to see your video about managing a stack in ARM. Awesome content!

Ответить
WistrelChianti
WistrelChianti - 19.02.2021 02:12

Just a note for anyone playing along with in old 32 bit raspbian, r15 gives a segmentation fault I think on the mov instruction. I think something to do with it being used for status flags (read somewhere) anyhow switching to r14 did the trick.

Ответить
arsebiscuitsandwine
arsebiscuitsandwine - 17.02.2021 11:05

These are really good tutorials dude, really well paced and easy to follow.

Ответить
Rex
Rex - 07.02.2021 19:00

This is exactly what I wanted. i've been learning Aarch64 assembly for two months now, the assembly syntax is absolutely beautiful.

Ответить
Abdallah Rashed
Abdallah Rashed - 24.01.2021 23:29

Thank you, please continue

Ответить
paulshankster
paulshankster - 21.01.2021 07:38

This is great! I have been searching for assembly tutorials, but most are for 32-bit x86, which won't run natively on my Surface Pro X or my Two Raspberry Pi 4's. Come to think of it, we also have 3 iPhones, an AppleTV and a Nintendo Switch. That's 8 devices, and they all use ARMv8-A chips. I'm glad someone is posting tutorials for code used in today's common devices.

Ответить
Oscar E
Oscar E - 21.01.2021 00:07

Good one, Yes to use the stack is a Great future video looking forward to that :)

Ответить
Dylan Fleming
Dylan Fleming - 17.01.2021 07:55

I've spent the last 3-4 hours learning Arm assembly via the documentation, started getting stuck when I wanted to make more complex things, just found your channel, and you've literally just put up a video explaining exactly the issue I was having!

Thank you so much, loved the video and I hope there's a lot more to come :D

Ответить