shithub: riscv

Download patch

ref: 35c9648ee10f187f1b2d0d3f884c40c95874d315
parent: 12bb7bcfff4db1b122c4643859f3d4f1420fba38
author: cinap_lenrek <[email protected]>
date: Thu Apr 30 12:29:40 EDT 2015

pass Ureg* argument to note handler in R0 register on arm

userspace note handlers, like any function, expect ther
first argument in R0 register on arm.

--- a/sys/src/9/kw/syscall.c
+++ b/sys/src/9/kw/syscall.c
@@ -78,6 +78,7 @@
 		nf->arg0 = &nf->ureg;
 		nf->ip = 0;
 		cur->sp = PTR2UINT(nf);
+		cur->r0 = PTR2UINT(nf->arg0);
 		break;
 	default:
 		up->lastnote.flag = NDebug;
@@ -163,6 +164,8 @@
 
 	ureg->sp = sp;
 	ureg->pc = PTR2UINT(up->notify);
+	ureg->r0 = PTR2UINT(nf->arg0);
+
 	up->notified = 1;
 	up->nnote--;
 	memmove(&up->lastnote, &up->note[0], sizeof(Note));
--- a/sys/src/9/omap/syscall.c
+++ b/sys/src/9/omap/syscall.c
@@ -78,6 +78,7 @@
 		nf->arg0 = &nf->ureg;
 		nf->ip = 0;
 		cur->sp = PTR2UINT(nf);
+		cur->r0 = PTR2UINT(nf->arg0);
 		break;
 	default:
 		up->lastnote.flag = NDebug;
@@ -163,6 +164,8 @@
 
 	ureg->sp = sp;
 	ureg->pc = PTR2UINT(up->notify);
+	ureg->r0 = PTR2UINT(nf->arg0);
+
 	up->notified = 1;
 	up->nnote--;
 	memmove(&up->lastnote, &up->note[0], sizeof(Note));
--- a/sys/src/9/teg2/syscall.c
+++ b/sys/src/9/teg2/syscall.c
@@ -84,6 +84,7 @@
 		nf->arg0 = &nf->ureg;
 		nf->ip = 0;
 		cur->sp = PTR2UINT(nf);
+		cur->r0 = PTR2UINT(nf->arg0);
 		break;
 	default:
 		up->lastnote.flag = NDebug;
@@ -169,6 +170,7 @@
 
 	ureg->sp = sp;
 	ureg->pc = PTR2UINT(up->notify);
+	ureg->r0 = PTR2UINT(nf->arg0);
 
 	up->notified = 1;
 	up->nnote--;
--- a/sys/src/9/zynq/trap.c
+++ b/sys/src/9/zynq/trap.c
@@ -423,6 +423,7 @@
 		sp = oureg - 4 * BY2WD - ERRMAX;
 		splhi();
 		ureg->sp = sp;
+		ureg->r0 = (uintptr) oureg;
 		((ulong *) sp)[1] = oureg;
 		((ulong *) sp)[0] = 0;
 		break;