summaryrefslogtreecommitdiff
path: root/boot/stage2.elna
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-04-21 22:56:50 +0200
committerEugen Wissner <belka@caraus.de>2025-04-21 22:56:50 +0200
commit536443b020d01d0d5372496529086a11b2486621 (patch)
tree78632939b6e12ec6281f99e394bd56d236c4b965 /boot/stage2.elna
parent148da8ed91f17c6fb367f52c927629b0f4cacb5e (diff)
downloadelna-536443b020d01d0d5372496529086a11b2486621.tar.gz
Add stages and a rakefile
Diffstat (limited to 'boot/stage2.elna')
-rw-r--r--boot/stage2.elna32
1 files changed, 32 insertions, 0 deletions
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