wires

summary refs log tree commit diff
path: root/src/startup.s
diff options
context:
space:
mode:
authorwires <wires@noreply.wires.systems>2025-03-19 17:09:41 -0400
committerwires <wires@noreply.wires.systems>2025-03-19 17:09:41 -0400
commit8466e9b4d2fbca85d53d8dadc87914b4766c43de (patch)
tree99a0d7a23e805f4ad3e30814ee9a09ebb00ae08b /src/startup.s
downloadzosimos-8466e9b4d2fbca85d53d8dadc87914b4766c43de.tar.gz
initial commit
Diffstat (limited to 'src/startup.s')
-rw-r--r--src/startup.s28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/startup.s b/src/startup.s
new file mode 100644
index 0000000..e0c6385
--- /dev/null
+++ b/src/startup.s
@@ -0,0 +1,28 @@
+.section ".init"
+.global _start
+
+_start:
+    mrs     x1, MPIDR_EL1
+    and     x1, x1, 0b11
+
+    cbz     x1, init
+halt:
+    wfe
+    b       halt
+
+init:
+    adr     x1, __stack_base
+    mov     sp, x1
+
+    adr     x1, __bss_start
+    adr     x2, __bss_size
+    cbz     x2, exec_kernel
+
+clear_bss:
+    str     xzr, [x1], 8
+    sub     x2, x2, 1
+    cbnz    w2, clear_bss
+
+exec_kernel:
+    bl      main
+    b       halt