procedure call instructions

  • procedure return

    • jumps and likns registers
      • jalr x0 0(x1) commonly used
      • jalr rd, imm(rs1) general form
        • like jal, but jumps to rs1+imm instead of PC+2*imm
      • imm is a 12 bit immediate value offset

Memory layout

top is kernal space (os)

Reseverd memory

  • bios
  • device

local and global memory

  • local memory will save the info into local
  • global will save it into the stack

Stack and risc V

  • to go to a specific point on the stack we need to do a “push and pop” using

    • addi sp, sp, -12 we are moving the stack to make room for 3 items (12 bites)
    • then we must do the opposite and add 12 to bring it back