Ritual I: Hello World
Words wait in silence.
The kernel carries their voice.
Return without trace.
Write an RV64 Linux program that prints Hello, RISC-V! followed by a newline, then exits successfully.
Begin at _start. Use only Linux write and exit system calls (i.e. no C library).
Reveal solution
.section .rodata
message:
.ascii "Hello, RISC-V!\n"
.equ message_len, . - message
.section .text
.globl _start
_start:
li a0, 1
la a1, message
li a2, message_len
li a7, 64
ecall
li a0, 0
li a7, 93
ecall
write receives the file descriptor, address, and length in a0–a2. The syscall number goes in a7. The second ecall exits with status zero.