elna/boot/stage2.elna

33 lines
575 B
Plaintext

.global _start, source_code
.equ SYS_READ, 63
.equ SYS_WRITE, 64
.equ SYS_EXIT, 93
.equ STDIN, 0
.equ STDOUT, 1
.equ STDERR, 2
.equ SOURCE_BUFFER_SIZE, 2048
.section .bss
.type source_code, @object
.size source_code, SOURCE_BUFFER_SIZE
source_code: .zero SOURCE_BUFFER_SIZE
.section .text
_start:
# Read the source from the standard input.
la a0, source_code
li a1, SOURCE_BUFFER_SIZE # Buffer size.
call read_file
# Write the source to the standard output.
mv a1, a0
la a0, source_code
call write_out
# Call exit.
li a0, 0 # Use 0 return code.
call exit