Handle VMs misbehaving.

If a VM accesses memory it is not allowed to or otherwise triggers and
unhandled exception it will be aborted such that none of the vCPUs can
be run again.

The VM remains unchanged from the point of view of other VMs other than
it will not make any further progress.

Change-Id: I352e1c714f1e4b1b43185269f92e7fa41e09a4db
diff --git a/src/abi_test.cc b/src/abi_test.cc
index fc64547..c01b726 100644
--- a/src/abi_test.cc
+++ b/src/abi_test.cc
@@ -189,6 +189,46 @@
 }
 
 /**
+ * Encode a 'notify waiters' response without leaking.
+ */
+TEST(abi, hf_vcpu_run_return_encode_notify_waiters)
+{
+	struct hf_vcpu_run_return res = dirty_vcpu_run_return();
+	res.code = HF_VCPU_RUN_NOTIFY_WAITERS;
+	EXPECT_THAT(hf_vcpu_run_return_encode(res), Eq(6));
+}
+
+/**
+ * Decode a 'notify waiters' response ignoring the irrelevant bits.
+ */
+TEST(abi, hf_vcpu_run_return_decode_notify_waiters)
+{
+	struct hf_vcpu_run_return res =
+		hf_vcpu_run_return_decode(0x1a1a1a1a2b2b2b06);
+	EXPECT_THAT(res.code, Eq(HF_VCPU_RUN_NOTIFY_WAITERS));
+}
+
+/**
+ * Encode an aborted response without leaking.
+ */
+TEST(abi, hf_vcpu_run_return_encode_aborted)
+{
+	struct hf_vcpu_run_return res = dirty_vcpu_run_return();
+	res.code = HF_VCPU_RUN_ABORTED;
+	EXPECT_THAT(hf_vcpu_run_return_encode(res), Eq(7));
+}
+
+/**
+ * Decode an aborted response ignoring the irrelevant bits.
+ */
+TEST(abi, hf_vcpu_run_return_decode_aborted)
+{
+	struct hf_vcpu_run_return res =
+		hf_vcpu_run_return_decode(0x31dbac4810fbc507);
+	EXPECT_THAT(res.code, Eq(HF_VCPU_RUN_ABORTED));
+}
+
+/**
  * Encode a mailbox receive response without leaking.
  */
 TEST(abi, hf_mailbox_receive_return_encode)
@@ -211,24 +251,4 @@
 	EXPECT_THAT(res.size, Eq(0x8badf00d));
 }
 
-/**
- * Encode a 'notify waiters' response without leaking.
- */
-TEST(abi, hf_vcpu_run_return_encode_interrupt)
-{
-	struct hf_vcpu_run_return res = dirty_vcpu_run_return();
-	res.code = HF_VCPU_RUN_NOTIFY_WAITERS;
-	EXPECT_THAT(hf_vcpu_run_return_encode(res), Eq(6));
-}
-
-/**
- * Decode a 'notify waiters' response ignoring the irrelevant bits.
- */
-TEST(abi, hf_vcpu_run_return_decode_interrupt)
-{
-	struct hf_vcpu_run_return res =
-		hf_vcpu_run_return_decode(0x1a1a1a1a2b2b2b06);
-	EXPECT_THAT(res.code, Eq(HF_VCPU_RUN_NOTIFY_WAITERS));
-}
-
 } /* namespace */