blob: de0fbfe18d395f5bddd339106d4f1b0c9b4211c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
.globl _start
.section .data
# x: .word 42 # Use a label to store the retval in the file's mem address space
.set retval, 88 # Use .set to create a symbol in the object/executable's symbol table
.section .text
# with the return value
_start:
# la t1, x # If we have the value stored in the .data section, we need to
# use 'la' to retrieve the address and
# lw a0, (t1) # 'lw' to load it into the register
li a0, retval # We have retval defined in the file's symbol table (use nm or readelf)
# to display the symbol table.
li a7, 93
ecall
|