diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-09 00:12:05 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-09 00:12:05 +0300 |
| commit | 42a1e087ce99f07b48aaea5552f8e1ce5219d228 (patch) | |
| tree | 086ac77af67a46ff4ba420c4562cbf6a57d09ab0 /arch/riscv64 | |
| parent | 658f21dd60bb930c5226b611bbe8cb95713b3f76 (diff) | |
| download | kmi-42a1e087ce99f07b48aaea5552f8e1ce5219d228.tar.gz kmi-42a1e087ce99f07b48aaea5552f8e1ce5219d228.zip | |
improve uapi
Diffstat (limited to 'arch/riscv64')
| -rw-r--r-- | arch/riscv64/kernel/entry.S (renamed from arch/riscv64/kernel/head.S) | 11 | ||||
| -rw-r--r-- | arch/riscv64/source.mk | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/arch/riscv64/kernel/head.S b/arch/riscv64/kernel/entry.S index cef74ba..0ff1a69 100644 --- a/arch/riscv64/kernel/head.S +++ b/arch/riscv64/kernel/entry.S @@ -81,16 +81,21 @@ handle_syscall: * restore its context */ /* TODO: is a whole function call necessary? */ mv s0, a0 + mv s1, a1 /* get current tcb */ call cur_tcb mv tp, a0 /* get associated kernel stack */ mv sp, tp addi sp, sp, -sizeof_registers + /* restore system call result */ + mv a0, s0 + mv a1, s1 j restore_noreturn restore_all: - lr s0, offsetof_s0(sp) + lr a0, offsetof_a0(sp) + lr a1, offsetof_a1(sp) restore_noreturn: /* restore registers besides possible return value, assume instruction @@ -103,13 +108,13 @@ restore_noreturn: lr t0, offsetof_t0(sp) lr t1, offsetof_t1(sp) lr t2, offsetof_t2(sp) - lr a0, offsetof_a0(sp) - lr a1, offsetof_a1(sp) + /* a0 and a1 should not be restored when coming from a syscall */ lr a2, offsetof_a2(sp) lr a3, offsetof_a3(sp) lr a4, offsetof_a4(sp) lr a5, offsetof_a5(sp) lr a6, offsetof_a6(sp) + lr s0, offsetof_s0(sp) lr s1, offsetof_s1(sp) lr s2, offsetof_s2(sp) lr s3, offsetof_s3(sp) diff --git a/arch/riscv64/source.mk b/arch/riscv64/source.mk index fcb7f69..bcbb809 100644 --- a/arch/riscv64/source.mk +++ b/arch/riscv64/source.mk @@ -21,4 +21,4 @@ run: include $(ARCH_SOURCE)/gen/source.mk # dependecy generation -$(ARCH_BUILD)/kernel/head.o: $(ARCH_SOURCE)/include/gen/asm-offsets.h +$(ARCH_BUILD)/kernel/entry.o: $(ARCH_SOURCE)/include/gen/asm-offsets.h |
