ref: 55f018df8a6006125dcfda55c412ee6908c9ed9b
parent: 9a9403bb665ee5f2b65176fd41c279b70ed1c21c
parent: 8d36cd8d8aa72e9897f39585d1655650b0ce2589
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Jun 14 06:32:26 EDT 2019
merge
--- a/sys/src/9/bcm64/l.s
+++ b/sys/src/9/bcm64/l.s
@@ -658,3 +658,16 @@
ORR $(3<<32), R0 // type
_vserrpatch:
B _vserrpatch // branch to vtrapX() patched in
+
+/* fault-proof memcpy */
+TEXT peek(SB), 1, $-4
+ MOV R0, R1
+ MOV dst+8(FP), R2
+ MOVWU len+16(FP), R0
+TEXT _peekinst(SB), 1, $-4
+_peekloop:
+ MOVBU (R1)1!, R3
+ MOVBU R3, (R2)1!
+ SUBS $1, R0
+ BNE _peekloop
+ RETURN
--- a/sys/src/9/bcm64/mkfile
+++ b/sys/src/9/bcm64/mkfile
@@ -65,6 +65,7 @@
/$objtype/lib/libsec.a\
/$objtype/lib/libmp.a\
/$objtype/lib/libc.a\
+ /$objtype/lib/libdtracy.a\
9:V: $p$CONF s$p$CONF
--- a/sys/src/9/bcm64/pi3
+++ b/sys/src/9/bcm64/pi3
@@ -21,6 +21,7 @@
# gpio gpio
sd
usb
+ dtracy
link
loopbackmedium
@@ -42,6 +43,9 @@
sdmmc emmc
dma
vcore
+
+ dtracysys
+ dtracytimer
port
int cpuserver = 0;
--- a/sys/src/9/bcm64/trap.c
+++ b/sys/src/9/bcm64/trap.c
@@ -442,13 +442,22 @@
insyscall = up->insyscall;
up->insyscall = 1;
- if(!userureg(ureg) && waserror()){
- if(up->nerrlab == 0){
- pprint("suicide: sys: %s\n", up->errstr);
- pexit(up->errstr, 1);
+ if(!userureg(ureg)){
+ extern void _peekinst(void);
+
+ if(ureg->pc == (uintptr)_peekinst){
+ ureg->pc = ureg->link;
+ goto out;
}
- up->insyscall = insyscall;
- nexterror();
+
+ if(waserror()){
+ if(up->nerrlab == 0){
+ pprint("suicide: sys: %s\n", up->errstr);
+ pexit(up->errstr, 1);
+ }
+ up->insyscall = insyscall;
+ nexterror();
+ }
}
addr = getfar();
@@ -486,6 +495,7 @@
if(!userureg(ureg))
poperror();
+out:
up->insyscall = insyscall;
}
--- a/sys/src/9/port/devdtracy.c
+++ b/sys/src/9/port/devdtracy.c
@@ -7,7 +7,7 @@
#include <dtracy.h>
-Lock *machlocks;
+static Lock *machlocks;
typedef struct DTKChan DTKChan;
typedef struct DTKAux DTKAux;
@@ -76,8 +76,8 @@
CMgo, "go", 1,
};
-DTKChan **dtktab;
-int ndtktab;
+static DTKChan **dtktab;
+static int ndtktab;
static DTKChan *
dtklook(vlong n)
@@ -555,7 +555,7 @@
}
}
-int peek(char *, char *, int);
+extern int peek(char *, char *, int);
int
dtpeek(uvlong addr, void *buf, int len)