elna/boot/echo-boot.s

36 lines
583 B
ArmAsm

.global _start, source_code
.section .rodata
.type SOURCE_BUFFER_SIZE, @object
.size SOURCE_BUFFER_SIZE, 4
SOURCE_BUFFER_SIZE: .long 4096
.section .bss
.type source_code, @object
.size source_code, 4096
source_code: .zero 4096
.section .text
_compile:
ret
_start:
# Read the source from the standard input.
la a0, source_code
la a1, SOURCE_BUFFER_SIZE # Buffer size.
lw a1, (a1)
call read_file
mv s1, a0
call _compile
# Write the source to the standard output.
la a0, source_code
mv a1, s1
call write_out
# Call exit.
li a0, 0 # Use 0 return code.
call exit