summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k/m88k/syscall.stub
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/mvme88k/m88k/syscall.stub')
-rw-r--r--sys/arch/mvme88k/m88k/syscall.stub29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/arch/mvme88k/m88k/syscall.stub b/sys/arch/mvme88k/m88k/syscall.stub
new file mode 100644
index 00000000000..4a1055556d1
--- /dev/null
+++ b/sys/arch/mvme88k/m88k/syscall.stub
@@ -0,0 +1,29 @@
+ /*
+ * system call will look like:
+ * ld r10, r31, 32; r10,r11,r12 might be garbage.
+ * ld r11, r31, 36
+ * ld r12, r31, 40
+ * or r13, r0, <code>
+ * tb0 0, r0, <128> <- xip
+ * br err <- nip
+ * jmp r1 <- fip
+ * err: or.u r3, r0, hi16(errno)
+ * st r2, r3, lo16(errno)
+ * subu r2, r0, 1
+ * jmp r1
+ *
+ * So, when we take syscall trap, sxip/snip/sfip will be as
+ * shown above.
+ * Given this,
+ * 1. If the system call returned 0, need to skip nip.
+ * nip = fip, fip += 4
+ * (doesn't matter what fip + 4 will be but we will never
+ * execute this since jmp r1 at nip will change the execution flow.)
+ * 2. If the system call returned an errno > 0, plug the value
+ * in r2, and leave nip and fip unchanged. This will have us
+ * executing "br err" on return to user space.
+ * 3. If the system call code returned ERESTART or EJUSTRETURN,
+ * we need to rexecute the trap instruction. Back up the pipe
+ * line.
+ * fip = nip, nip = xip
+ */