os/asm/boot.s \
os/asm/context.s \
os/asm/exception.s \
+ os/asm/idle_thread.s \
os/asm/message.s \
os/asm/syscall.s \
)
CFILES = $(call FIXPATH,\
os/fbtext.c \
- os/idle_thread.c \
os/main.c \
os/mm.c \
os/panic.c \
--- /dev/null
+#
+# libn64/os/asm/idle_thread.s: libn64 idle thread.
+#
+# n64chain: A (free) open-source N64 development toolchain.
+# Copyright 2014-16 Tyler J. Stachecki <stachecki.tyler@gmail.com>
+#
+# This file is subject to the terms and conditions defined in
+# 'LICENSE', which is part of this source code package.
+#
+
+#include <libn64.h>
+
+.section .text.libn64.ipl, "ax", @progbits
+
+.set noat
+.set gp=64
+.set noreorder
+
+# -------------------------------------------------------------------
+# This thread invokes main and then spins continuously.
+# -------------------------------------------------------------------
+.global libn64_idle_thread
+.type libn64_idle_thread, @function
+.align 5
+libn64_idle_thread:
+ la $a0, main
+ xor $a1, $a1, $a2
+ addiu $a2, $zero, 0x1
+ xor $at, $at, $at
+ syscall
+
+libn64_idle_thread_spin:
+ j libn64_idle_thread_spin
+ nop
+
+.size libn64_idle_thread,.-libn64_idle_thread
+
+.set at
+.set gp=default
+.set reorder
+
+++ /dev/null
-//
-// libn64/os/idle_thread.c: libn64 idle thread.
-//
-// n64chain: A (free) open-source N64 development toolchain.
-// Copyright 2014-16 Tyler J. Stachecki <stachecki.tyler@gmail.com>
-//
-// This file is subject to the terms and conditions defined in
-// 'LICENSE', which is part of this source code package.
-//
-
-#include <os/idle_thread.h>
-
-void libn64_idle_thread(void) {
- while (1);
- __builtin_unreachable();
-}
-
// Put the given physical memory region under control of the MM.
libn64_mm_init(bss_end, kernel_sp - 256);
- // Hand control over to the application (in another thread).
- libn64_thread_create(main, NULL, LIBN64_THREAD_MIN_PRIORITY + 1);
-
- // This thread becomes the idle thread.
+ // This thread invokes main() and becomes the idle thread.
libn64_idle_thread();
__builtin_unreachable();
}