Skip to the content.

https://mariokartwii.com/armv8/

yc 的讨论: https://news.ycombinator.com/item?id=39002028

ch4 : Basic Registers

FP(r29) SP(r31) 就不说了,LR 就是函数调用的时候存放 PC 到 LR(r30) 中 PC 是 r32

ch6 : Instruction Format

扩展: https://developer.arm.com/documentation/dui0801/l/Overview-of-AArch64-state/Predeclared-core-register-names-in-AArch64-state

XZR WZR

SP WSP

https://stackoverflow.com/questions/61532867/in-arm64-assembly-code-when-is-register-31-xzr-versus-sp

扩展: https://wiki.cdot.senecapolytechnic.ca/wiki/AArch64_Register_and_Instruction_Quick_Start

Usage during syscall/function call:

https://eclecticlight.co/wp-content/uploads/2021/06/armregisterarch.pdf

ch11 : Pre and Post Index of Loads/Stores

Pre-Index Store:

str x0, [x1, #0x4]!

Post-Index Store:

str x0, [x1], #0x4

ch20 : Address Relative Loading

ch21

https://mariokartwii.com/armv8/

ch22: Load & Store Pair

stp w1, w5, [x12]

Pretend w1 = 0x11112222
Pretend w5 = 0x000000A0
Pretend x12 = 0x40007FFC30

The above instruction will store 0x11112222 at 0x40007FFC30, and 0x000000A0 at 0x40007FFC34.

ch24: Float Basics

还有很多就不看了

asm_book

这本书应该在 github 上阅读还是 nice 的 https://github.com/pkivolowitz/asm_book#table-of-contents

其他

wzr 就是 0

https://stackoverflow.com/questions/42788696/why-might-one-use-the-xzr-register-instead-of-the-literal-0-on-armv8

TODO

理解下 gdb 中各个字段的含义

                 x0 0x0000000000000014                   x1 0x0000fffff7ffbb28                 x2 0x0000000000000000
                 x3 0x0000000000000000                   x4 0x0000ffffffffe48c                 x5 0x00000000004442b4
                 x6 0x000000000000000a                   x7 0x0000000000000001                 x8 0x0000000000000040
                 x9 0x0000000000000010                  x10 0x000000000000000a                x11 0x0000000000000000
                x12 0x00000000ffffffc8                  x13 0x0000ffffffffe620                x14 0x0000000000000000
                x15 0x000000000055acae                  x16 0x0000000000440018                x17 0x0000fffff7e0c1c0
                x18 0x0000000000003fff                  x19 0x0000ffffffffe7f8                x20 0x0000000000000001
                x21 0x000000000043fdf0                  x22 0x00000000004100b4                x23 0x0000ffffffffe808
                x24 0x0000fffff7ffbb30                  x25 0x0000000000000000                x26 0x0000fffff7ffc000
                x27 0x000000000043fdf0                  x28 0x0000000000000000                x29 0x0000ffffffffe690
                x30 0x00000000004101b8                   sp 0x00010001d0428d30                 pc 0x00000000004101b8
               cpsr [ EL=0 BTYPE=0 SSBS C Z ]          fpsr [ ]                              fpcr [ Len=0 Stride=0 RMode=0 ]
              tpidr 0x0000fffff7fff4a0               tpidr2 0x0000000000000000        pauth_dmask 0x007f000000000000
        pauth_cmask 0x007f000000000000

这个看看,其中

https://devblogs.microsoft.com/oldnewthing/20220811-00/?p=106963

ldur

LDR 和 LDUR 是什么关系来着?

C3.2.2 Load/Store register (unscaled offset) 没看懂

如何知道那个 CPU 的版本是哪一个

现在是通过 https://en.wikipedia.org/wiki/Apple_M2

才知道是环境中是这个: Instruction set ARMv8.6-A

可以通过 cpuid.c 获取吗?

kernel 会知道那些指令有,那些没有吗?

本站所有文章转发 CSDN 将按侵权追究法律责任,其它情况随意。