shithub: riscv

Download patch

ref: cabfa4e9160d0fbaec57eab5e9d264dc555e0275
parent: 5c0bff4ba204cfad7aedb8c1c20f1c29265dcb01
author: aiju <devnull@localhost>
date: Wed Jun 21 18:19:14 EDT 2017

devvmx: add support for extrap command to configure halting on exceptions

--- a/sys/src/9/pc/devvmx.c
+++ b/sys/src/9/pc/devvmx.c
@@ -1445,6 +1445,18 @@
 	return 0;
 }
 
+static int
+cmdextrap(VmCmd *, va_list va)
+{
+	char *p, *q;
+	u32int v;
+	
+	p = va_arg(va, char *);
+	v = strtoul(p, &q, 0);
+	if(q == p || *q != 0) error(Ebadarg);
+	vmcswrite(EXC_BITMAP, v);
+	return 0;
+}
 
 static int
 gotcmd(void *)
@@ -1669,6 +1681,7 @@
 	CMstep,
 	CMexc,
 	CMirq,
+	CMextrap,
 };
 
 static Cmdtab vmxctlmsg[] = {
@@ -1679,6 +1692,7 @@
 	CMstep,		"step",		0,
 	CMexc,		"exc",		2,
 	CMirq,		"irq",		0,
+	CMextrap,	"extrap",	2,
 };
 
 static int
@@ -1921,6 +1935,18 @@
 			poperror();
 			free(s);
 			break;
+		case CMextrap:
+			s = nil;
+			kstrdup(&s, cb->f[1]);
+			if(waserror()){
+				free(s);
+				nexterror();
+			}
+			vmxcmd(cmdextrap, s);
+			poperror();
+			free(s);
+			break;
+
 		default:
 			error(Egreg);
 		}