From 536443b020d01d0d5372496529086a11b2486621 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Mon, 21 Apr 2025 22:56:50 +0200 Subject: Add stages and a rakefile --- boot/stage2.elna | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 boot/stage2.elna (limited to 'boot/stage2.elna') diff --git a/boot/stage2.elna b/boot/stage2.elna new file mode 100644 index 0000000..a119f4a --- /dev/null +++ b/boot/stage2.elna @@ -0,0 +1,32 @@ +.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 -- cgit v1.2.3