This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
Create link register arm64.md
Abdul Wahab Junaid1069bdd59c25
diff --git a/Reverse Engineering/Malware Data/Malware/link register arm64.md b/Reverse Engineering/Malware Data/Malware/link register arm64.mdnew file mode 100644index 0000000..98876d7--- /dev/null+++ b/Reverse Engineering/Malware Data/Malware/link register arm64.md@@ -0,0 +1,61 @@+The Link Register (LR) in ARM64 architecture is a special-purpose register (register `X30`) used to store the return address for function calls. When a function is called using the `BL` (Branch with Link) instruction, the return address (the address of the next instruction after the `BL`) is stored in the LR. After the function completes, the program can return to the caller by branching to the address stored in the LR.++A simple ARM64 assembly code demo to illustrate how the Link Register works:++### ARM64 Assembly Code Example++```assembly+.global _start++_start:+ // Main program starts here+ MOV X0, #1 // Load value 1 into register X0+ MOV X1, #2 // Load value 2 into register X1+ BL add_numbers // Call the function 'add_numbers'+ // The return address (next instruction) is stored in LR (X30)++ // After returning from the function+ B end_program // Branch to end_program to exit++add_numbers:+ // Function to add two numbers+ ADD X0, X0, X1 // Add X0 and X1, result in X0+ RET // Return to the address stored in LR (X30)++end_program:+ // End of program+ MOV X0, #0 // Set return value to 0+ MOV X8, #93 // syscall: exit+ SVC #0 // Make the system call+```++### Explanation of the Code++1. **`_start`**:+ - This is the entry point of the program.+ - The program loads values `1` and `2` into registers `X0` and `X1`, respectively.+ - The `BL add_numbers` instruction calls the `add_numbers` function. The address of the next instruction (after `BL`) is stored in the Link Register (`X30`).++2. **`add_numbers`**:+ - This function adds the values in `X0` and `X1` and stores the result in `X0`.+ - The `RET` instruction branches to the address stored in the Link Register (`X30`), effectively returning control to the caller.++3. **`end_program`**:+ - After returning from the function, the program branches to `end_program`.+ - The program sets the return value to `0` and makes a system call to exit.++### How the Link Register Works++- When `BL add_numbers` is executed:+ - The address of the next instruction (after `BL`) is saved in the Link Register (`X30`).+ - The program counter (`PC`) is updated to the address of `add_numbers`.++- When `RET` is executed:+ - The program counter (`PC`) is set to the value stored in the Link Register (`X30`), which is the return address.+ - This allows the program to continue execution from where the function was called.++### Key Points++- The Link Register (`X30`) is used to store the return address for function calls.+- The `BL` instruction automatically saves the return address in `X30`.+- The `RET` instruction uses the value in `X30` to return to the caller.