aboutsummaryrefslogtreecommitdiff
path: root/sys/riscv
diff options
context:
space:
mode:
authorRuslan Bukin <br@FreeBSD.org>2016-02-17 13:49:38 +0000
committerRuslan Bukin <br@FreeBSD.org>2016-02-17 13:49:38 +0000
commit6cb16b7e7a668b8f0bfd27f51dba9005d42f0ca1 (patch)
tree990742fc3ce3b9b62c794b782dc915a4ad62b14e /sys/riscv
parent486ff49853b412f9da2fe944fd88e87ccd7d88eb (diff)
downloadsrc-6cb16b7e7a668b8f0bfd27f51dba9005d42f0ca1.tar.gz
src-6cb16b7e7a668b8f0bfd27f51dba9005d42f0ca1.zip
Add the implementation of savectx().
Notes
Notes: svn path=/head/; revision=295698
Diffstat (limited to 'sys/riscv')
-rw-r--r--sys/riscv/riscv/swtch.S27
1 files changed, 23 insertions, 4 deletions
diff --git a/sys/riscv/riscv/swtch.S b/sys/riscv/riscv/swtch.S
index 413e666fa0d8..1a9092f26cdf 100644
--- a/sys/riscv/riscv/swtch.S
+++ b/sys/riscv/riscv/swtch.S
@@ -256,8 +256,27 @@ ENTRY(fork_trampoline)
END(fork_trampoline)
ENTRY(savectx)
- la a0, .Lsavectx_panic_str
- call panic
-.Lsavectx_panic_str:
- .asciz "savectx_panic: %p\0"
+ /* Store ra, sp and the callee-saved registers */
+ sd ra, (PCB_RA)(a0)
+ sd sp, (PCB_SP)(a0)
+
+ /* s[0-11] */
+ sd s0, (PCB_S + 0 * 8)(a0)
+ sd s1, (PCB_S + 1 * 8)(a0)
+ sd s2, (PCB_S + 2 * 8)(a0)
+ sd s3, (PCB_S + 3 * 8)(a0)
+ sd s4, (PCB_S + 4 * 8)(a0)
+ sd s5, (PCB_S + 5 * 8)(a0)
+ sd s6, (PCB_S + 6 * 8)(a0)
+ sd s7, (PCB_S + 7 * 8)(a0)
+ sd s8, (PCB_S + 8 * 8)(a0)
+ sd s9, (PCB_S + 9 * 8)(a0)
+ sd s10, (PCB_S + 10 * 8)(a0)
+ sd s11, (PCB_S + 11 * 8)(a0)
+
+ /* Store the VFP registers */
+#ifdef VFP
+ /* TODO */
+#endif
+ ret
END(savectx)