changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: bcm64: implement dtracy support

changeset 7268: cbd1f567e273
parent 7262: f0621f169310
child 7269: df67aba62834
author: cinap_lenrek@felloff.net
date: Fri, 14 Jun 2019 10:28:30 +0200
files: sys/src/9/bcm64/l.s sys/src/9/bcm64/mkfile sys/src/9/bcm64/pi3 sys/src/9/bcm64/trap.c
description: bcm64: implement dtracy support
     1.1--- a/sys/src/9/bcm64/l.s
     1.2+++ b/sys/src/9/bcm64/l.s
     1.3@@ -658,3 +658,16 @@ TEXT vserr(SB), 1, $-4
     1.4 	ORR	$(3<<32), R0	// type
     1.5 _vserrpatch:
     1.6 	B	_vserrpatch	// branch to vtrapX() patched in
     1.7+
     1.8+/* fault-proof memcpy */
     1.9+TEXT peek(SB), 1, $-4
    1.10+	MOV	R0, R1
    1.11+	MOV	dst+8(FP), R2
    1.12+	MOVWU	len+16(FP), R0
    1.13+TEXT _peekinst(SB), 1, $-4
    1.14+_peekloop:
    1.15+	MOVBU	(R1)1!, R3
    1.16+	MOVBU	R3, (R2)1!
    1.17+	SUBS	$1, R0
    1.18+	BNE	_peekloop
    1.19+	RETURN
     2.1--- a/sys/src/9/bcm64/mkfile
     2.2+++ b/sys/src/9/bcm64/mkfile
     2.3@@ -65,6 +65,7 @@ LIB=\
     2.4 	/$objtype/lib/libsec.a\
     2.5 	/$objtype/lib/libmp.a\
     2.6 	/$objtype/lib/libc.a\
     2.7+	/$objtype/lib/libdtracy.a\
     2.8 
     2.9 9:V: $p$CONF s$p$CONF
    2.10 
     3.1--- a/sys/src/9/bcm64/pi3
     3.2+++ b/sys/src/9/bcm64/pi3
     3.3@@ -21,6 +21,7 @@ dev
     3.4 #	gpio	gpio
     3.5 	sd
     3.6 	usb
     3.7+	dtracy
     3.8 
     3.9 link
    3.10 	loopbackmedium
    3.11@@ -43,6 +44,9 @@ misc
    3.12 	dma
    3.13 	vcore
    3.14 
    3.15+	dtracysys
    3.16+	dtracytimer
    3.17+
    3.18 port
    3.19 	int cpuserver = 0;
    3.20 
     4.1--- a/sys/src/9/bcm64/trap.c
     4.2+++ b/sys/src/9/bcm64/trap.c
     4.3@@ -442,13 +442,22 @@ faultarm64(Ureg *ureg)
     4.4 	insyscall = up->insyscall;
     4.5 	up->insyscall = 1;
     4.6 
     4.7-	if(!userureg(ureg) && waserror()){
     4.8-		if(up->nerrlab == 0){
     4.9-			pprint("suicide: sys: %s\n", up->errstr);
    4.10-			pexit(up->errstr, 1);
    4.11+	if(!userureg(ureg)){
    4.12+		extern void _peekinst(void);
    4.13+
    4.14+		if(ureg->pc == (uintptr)_peekinst){
    4.15+			ureg->pc = ureg->link;
    4.16+			goto out;
    4.17 		}
    4.18-		up->insyscall = insyscall;
    4.19-		nexterror();
    4.20+
    4.21+		if(waserror()){
    4.22+			if(up->nerrlab == 0){
    4.23+				pprint("suicide: sys: %s\n", up->errstr);
    4.24+				pexit(up->errstr, 1);
    4.25+			}
    4.26+			up->insyscall = insyscall;
    4.27+			nexterror();
    4.28+		}
    4.29 	}
    4.30 
    4.31 	addr = getfar();
    4.32@@ -486,6 +495,7 @@ faultarm64(Ureg *ureg)
    4.33 	if(!userureg(ureg))
    4.34 		poperror();
    4.35 
    4.36+out:
    4.37 	up->insyscall = insyscall;
    4.38 }
    4.39