Skip to content

Instantly share code, notes, and snippets.

@lucmann
Last active July 17, 2024 04:29
Show Gist options
  • Save lucmann/913cde879ec444fc639f5567df816099 to your computer and use it in GitHub Desktop.
Save lucmann/913cde879ec444fc639f5567df816099 to your computer and use it in GitHub Desktop.
riscv assembly
  • beqz s0, 1f Expands to beq s0, x0, 1f jump to label 1f if s0 == x0. Note that label 1f means to go to numeric label 1 FORWARD of the given position whose opposite is label 1b meaning to go to numeric label 1 BACKWARD of the given position.
  • csrrw t3, CSR_SSCRATCH, a0 Write the value in the csr register CSR_SSCRATCH to t3 register and write the value in a0 back to CSR_SSCRATCH
  • jal purgatory Expands to jal x1, purgatory and unconditionally jump to function purgatory() and write PC+4 into x1 (return address) register
  • jal t0, .Lbyte_copy_until_aligned_forward Write PC+4 into register t0 and unconditionally jump to label .Lbyte_copy_until_aligned_forward.
  • jalr s0 Expands to jalr x1, s0, 0 meaning the target address to jump to is s0 + 0 and write PC+4 into x1 (return address) register
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment