summaryrefslogtreecommitdiff
path: root/na/arch/riscv/syscall
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-07-10 11:24:56 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-07-10 11:24:56 +0800
commit1767d390fbf3d0c65389de46caf0b6d43ef3b6ad (patch)
tree0f5e01cd7c7a05abb6b1c7472d7f00f49caf02cc /na/arch/riscv/syscall
parent63dc025705f6533b91fb1a7d26e6ed864efd9900 (diff)
downloadlume-1767d390fbf3d0c65389de46caf0b6d43ef3b6ad.tar.gz
lume-1767d390fbf3d0c65389de46caf0b6d43ef3b6ad.tar.xz
feat: establish bootable new architecture checkpoint
Replace the compressed boot path with a relocatable higher-half RISC-V entry, expand memory and SMP support, and add the driver, TTY, VFS, exec, signal, syscall, initramfs, and self-test infrastructure needed for a bootable kernel checkpoint.
Diffstat (limited to 'na/arch/riscv/syscall')
-rw-r--r--na/arch/riscv/syscall/syscall_md.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/na/arch/riscv/syscall/syscall_md.cc b/na/arch/riscv/syscall/syscall_md.cc
index a52eb0e..26320c8 100644
--- a/na/arch/riscv/syscall/syscall_md.cc
+++ b/na/arch/riscv/syscall/syscall_md.cc
@@ -11,7 +11,9 @@
*/
#include <lume/syscall.h>
+#include <lume/syscall_nr.h>
#include <arch/trapframe.h>
+#include <arch/cpu.h>
void syscall_dispatch_md(arch::TrapFrame* tf)
{
@@ -22,7 +24,19 @@ void syscall_dispatch_md(arch::TrapFrame* tf)
tf->a[3], tf->a[4], tf->a[5],
};
+ /* Enable interrupts so timer and preemption work during syscalls */
+ arch::cpu::intr_on();
+
int64 ret = syscall_dispatch(nr, args);
+ arch::cpu::intr_off();
+
+ /* sys_rt_sigreturn restores the entire TrapFrame from the signal
+ * frame on the user stack. Writing ret into a[0] would clobber
+ * the restored value, so we must skip the writeback. */
+ if (nr == static_cast<uint64>(SYS_rt_sigreturn)){
+ return;
+ }
tf->a[0] = static_cast<uint64>(ret); /* Return value in a0 */
}
+