CPU & register

The function of a register is to temporarily store data, and the CPU has a fast computing speed. For performance, the CPU creates a temporary storage area inside the CPU. The data is copied from the memory to this temporary storage area during calculation, and the operation is carried out in this area

For ARM64 cpus, a register that begins with an X indicates a 64-bit register, and a register that begins with a W indicates a 32-bit register, where the 32-bit register is the lower 32 bits of the 64-bit register and does not exist independently

- You can control the CPU by changing the contents of the registers - Different cpus, the number of registers, the structure is differentCopy the code

Floating point register

Universal register

  • The general purpose register, also known as the data address register, is usually used for temporary storage, accumulation, counting, address storage and other functions of data calculation
  • Arm64 has 32 64-bit universal registers X0 to X32, as well as XZR(zero register)
    • W0 to W28 are 32-bit, and since 64-bit cpus are compatible with 32-bit, the lower 32 bits of the 64-bit register can be used
    • W0 is the lower 32 bits of x0

Put -1 into the register

PC register

  • The PC register is the instruction pointer register, which represents the address of the instruction that the CPU is currently reading
  • In memory and on disk there is no difference between data and instructions, it is binary information
  • The CPU treats the contents of a memory cell pointed to by a PC register as instructions
  • If an instruction in memory is executed by the CPU, the memory unit in which it resides must be pointed to by the PC

To change the execution order of assembly instructions by modifying the value of a PC register

Bl instruction

Arm64 provides mov transfer instructions that can be used to change most values, but MOV cannot change the finger of a PC. Arm64 provides BL instructions to change the value of a PC