diff options
| author | Carlos Maiolino <[email protected]> | 2025-07-10 22:18:39 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-07-10 22:18:39 +0200 |
| commit | 8c6fc0c15415b32080a848bbde640e104098cf13 (patch) | |
| tree | 04a21bd28f9dc82c8e216390d6208ed93b9bcd11 /riscv/location_counter.s | |
Initial drop
Add some riscv code
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'riscv/location_counter.s')
| -rw-r--r-- | riscv/location_counter.s | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/riscv/location_counter.s b/riscv/location_counter.s new file mode 100644 index 0000000..de0fbfe --- /dev/null +++ b/riscv/location_counter.s @@ -0,0 +1,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 |
