CVS commit: src/tests/lib/libnvmm

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:05:14 UTC 2023

Modified Files:
src/tests/lib/libnvmm: t_io_assist.sh t_mem_assist.sh

Log Message:
tests/lib/libnvmm: Tests require privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libnvmm/t_io_assist.sh \
src/tests/lib/libnvmm/t_mem_assist.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libnvmm/t_io_assist.sh
diff -u src/tests/lib/libnvmm/t_io_assist.sh:1.2 src/tests/lib/libnvmm/t_io_assist.sh:1.3
--- src/tests/lib/libnvmm/t_io_assist.sh:1.2	Sat Sep  5 07:22:26 2020
+++ src/tests/lib/libnvmm/t_io_assist.sh	Sat Aug  5 13:05:14 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: t_io_assist.sh,v 1.2 2020/09/05 07:22:26 maxv Exp $
+#	$NetBSD: t_io_assist.sh,v 1.3 2023/08/05 13:05:14 riastradh Exp $
 #
 # Copyright (c) 2019-2020 Maxime Villard, m00nbsd.net
 # All rights reserved.
@@ -31,6 +31,7 @@ atf_test_case io_assist
 io_assist_head()
 {
 	atf_set "descr" "Check the I/O Assist provided in libnvmm"
+	atf_set "require.user" "root"
 }
 
 io_assist_body()
Index: src/tests/lib/libnvmm/t_mem_assist.sh
diff -u src/tests/lib/libnvmm/t_mem_assist.sh:1.2 src/tests/lib/libnvmm/t_mem_assist.sh:1.3
--- src/tests/lib/libnvmm/t_mem_assist.sh:1.2	Sat Sep  5 07:22:26 2020
+++ src/tests/lib/libnvmm/t_mem_assist.sh	Sat Aug  5 13:05:14 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: t_mem_assist.sh,v 1.2 2020/09/05 07:22:26 maxv Exp $
+#	$NetBSD: t_mem_assist.sh,v 1.3 2023/08/05 13:05:14 riastradh Exp $
 #
 # Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
 # All rights reserved.
@@ -31,6 +31,7 @@ atf_test_case mem_assist
 mem_assist_head()
 {
 	atf_set "descr" "Check the Mem Assist provided in libnvmm"
+	atf_set "require.user" "root"
 }
 
 mem_assist_body()



CVS commit: src/tests/lib/libnvmm

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 13:05:14 UTC 2023

Modified Files:
src/tests/lib/libnvmm: t_io_assist.sh t_mem_assist.sh

Log Message:
tests/lib/libnvmm: Tests require privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libnvmm/t_io_assist.sh \
src/tests/lib/libnvmm/t_mem_assist.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libnvmm

2019-11-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 22 10:26:32 UTC 2019

Modified Files:
src/tests/lib/libnvmm: h_mem_assist.c

Log Message:
Several improvements. In particular, reduce CS.limit, because Intel CPUs
perform strict sanity checks, and the previous (too high) limit caused the
VM entry to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libnvmm/h_mem_assist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libnvmm/h_mem_assist.c
diff -u src/tests/lib/libnvmm/h_mem_assist.c:1.17 src/tests/lib/libnvmm/h_mem_assist.c:1.18
--- src/tests/lib/libnvmm/h_mem_assist.c:1.17	Sun Oct 27 07:08:15 2019
+++ src/tests/lib/libnvmm/h_mem_assist.c	Fri Nov 22 10:26:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_mem_assist.c,v 1.17 2019/10/27 07:08:15 maxv Exp $	*/
+/*	$NetBSD: h_mem_assist.c,v 1.18 2019/11/22 10:26:32 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -113,7 +113,7 @@ run_machine(struct nvmm_machine *mach, s
 			return;
 
 		default:
-			printf("Invalid!\n");
+			printf("Invalid VMEXIT: 0x%lx\n", exit->reason);
 			return;
 		}
 	}
@@ -177,22 +177,22 @@ extern uint8_t test_64bit_15_begin, test
 extern uint8_t test_64bit_16_begin, test_64bit_16_end;
 
 static const struct test tests64[] = {
-	{ "test1 - MOV", _begin, _end, 0x3004, 0 },
-	{ "test2 - OR",  _begin, _end, 0x16FF, 0 },
-	{ "test3 - AND", _begin, _end, 0x1FC0, 0 },
-	{ "test4 - XOR", _begin, _end, 0x10CF, 0 },
-	{ "test5 - Address Sizes", _begin, _end, 0x1F00, 0 },
-	{ "test6 - DMO", _begin, _end, 0xFFAB, 0 },
-	{ "test7 - STOS", _begin, _end, 0x00123456, 0 },
-	{ "test8 - LODS", _begin, _end, 0x12345678, 0 },
-	{ "test9 - MOVS", _begin, _end, 0x12345678, 0 },
-	{ "test10 - MOVZXB", _begin, _end, 0x0078, 0 },
-	{ "test11 - MOVZXW", _begin, _end, 0x5678, 0 },
-	{ "test12 - CMP", _begin, _end, 0x0001, 0 },
-	{ "test13 - SUB", _begin, _end, 0x000FA0FF, 0 },
-	{ "test14 - TEST", _begin, _end, 0x0001, 0 },
-	{ "test15 - XCHG", _64bit_15_begin, _64bit_15_end, 0x123456, 0 },
-	{ "test16 - XCHG", _64bit_16_begin, _64bit_16_end,
+	{ "64bit test1 - MOV", _begin, _end, 0x3004, 0 },
+	{ "64bit test2 - OR",  _begin, _end, 0x16FF, 0 },
+	{ "64bit test3 - AND", _begin, _end, 0x1FC0, 0 },
+	{ "64bit test4 - XOR", _begin, _end, 0x10CF, 0 },
+	{ "64bit test5 - Address Sizes", _begin, _end, 0x1F00, 0 },
+	{ "64bit test6 - DMO", _begin, _end, 0xFFAB, 0 },
+	{ "64bit test7 - STOS", _begin, _end, 0x00123456, 0 },
+	{ "64bit test8 - LODS", _begin, _end, 0x12345678, 0 },
+	{ "64bit test9 - MOVS", _begin, _end, 0x12345678, 0 },
+	{ "64bit test10 - MOVZXB", _begin, _end, 0x0078, 0 },
+	{ "64bit test11 - MOVZXW", _begin, _end, 0x5678, 0 },
+	{ "64bit test12 - CMP", _begin, _end, 0x0001, 0 },
+	{ "64bit test13 - SUB", _begin, _end, 0x000FA0FF, 0 },
+	{ "64bit test14 - TEST", _begin, _end, 0x0001, 0 },
+	{ "64bit test15 - XCHG", _64bit_15_begin, _64bit_15_end, 0x123456, 0 },
+	{ "64bit test16 - XCHG", _64bit_16_begin, _64bit_16_end,
 	  0x123456, 0 },
 	{ NULL, NULL, NULL, -1, 0 }
 };
@@ -218,6 +218,9 @@ reset_machine64(struct nvmm_machine *mac
 {
 	struct nvmm_x64_state *state = vcpu->state;
 
+	if (nvmm_vcpu_getstate(mach, vcpu, NVMM_X64_STATE_ALL) == -1)
+		err(errno, "nvmm_vcpu_getstate");
+
 	memset(state, 0, sizeof(*state));
 
 	/* Default. */
@@ -365,6 +368,8 @@ test_vm64(void)
 		run_test(, , [i]);
 	}
 
+	if (nvmm_vcpu_destroy(, ) == -1)
+		err(errno, "nvmm_vcpu_destroy");
 	if (nvmm_machine_destroy() == -1)
 		err(errno, "nvmm_machine_destroy");
 }
@@ -400,10 +405,10 @@ reset_machine16(struct nvmm_machine *mac
 	struct nvmm_x64_state *state = vcpu->state;
 
 	if (nvmm_vcpu_getstate(mach, vcpu, NVMM_X64_STATE_ALL) == -1)
-		err(errno, "nvmm_vcpu_setstate");
+		err(errno, "nvmm_vcpu_getstate");
 
 	state->segs[NVMM_X64_SEG_CS].base = 0;
-	state->segs[NVMM_X64_SEG_CS].limit = 0x;
+	state->segs[NVMM_X64_SEG_CS].limit = 0x2FFF;
 	state->gprs[NVMM_X64_GPR_RIP] = 0x2000;
 
 	if (nvmm_vcpu_setstate(mach, vcpu, NVMM_X64_STATE_ALL) == -1)
@@ -451,6 +456,8 @@ test_vm16(void)
 		run_test(, , [i]);
 	}
 
+	if (nvmm_vcpu_destroy(, ) == -1)
+		err(errno, "nvmm_vcpu_destroy");
 	if (nvmm_machine_destroy() == -1)
 		err(errno, "nvmm_machine_destroy");
 }



CVS commit: src/tests/lib/libnvmm

2019-11-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Nov 22 10:26:32 UTC 2019

Modified Files:
src/tests/lib/libnvmm: h_mem_assist.c

Log Message:
Several improvements. In particular, reduce CS.limit, because Intel CPUs
perform strict sanity checks, and the previous (too high) limit caused the
VM entry to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/lib/libnvmm/h_mem_assist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libnvmm

2019-10-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 14 01:15:32 UTC 2019

Modified Files:
src/tests/lib/libnvmm: h_mem_assist.c

Log Message:
add missing initializer


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libnvmm/h_mem_assist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libnvmm

2019-10-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 14 01:15:32 UTC 2019

Modified Files:
src/tests/lib/libnvmm: h_mem_assist.c

Log Message:
add missing initializer


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/lib/libnvmm/h_mem_assist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libnvmm/h_mem_assist.c
diff -u src/tests/lib/libnvmm/h_mem_assist.c:1.12 src/tests/lib/libnvmm/h_mem_assist.c:1.13
--- src/tests/lib/libnvmm/h_mem_assist.c:1.12	Sun Oct 13 13:32:15 2019
+++ src/tests/lib/libnvmm/h_mem_assist.c	Sun Oct 13 21:15:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_mem_assist.c,v 1.12 2019/10/13 17:32:15 maxv Exp $	*/
+/*	$NetBSD: h_mem_assist.c,v 1.13 2019/10/14 01:15:32 christos Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -175,21 +175,21 @@ extern uint8_t test13_begin, test13_end;
 extern uint8_t test14_begin, test14_end;
 
 static const struct test tests64[] = {
-	{ "test1 - MOV", _begin, _end, 0x3004 },
-	{ "test2 - OR",  _begin, _end, 0x16FF },
-	{ "test3 - AND", _begin, _end, 0x1FC0 },
-	{ "test4 - XOR", _begin, _end, 0x10CF },
-	{ "test5 - Address Sizes", _begin, _end, 0x1F00 },
-	{ "test6 - DMO", _begin, _end, 0xFFAB },
-	{ "test7 - STOS", _begin, _end, 0x00123456 },
-	{ "test8 - LODS", _begin, _end, 0x12345678 },
-	{ "test9 - MOVS", _begin, _end, 0x12345678 },
-	{ "test10 - MOVZXB", _begin, _end, 0x0078 },
-	{ "test11 - MOVZXW", _begin, _end, 0x5678 },
-	{ "test12 - CMP", _begin, _end, 0x0001 },
-	{ "test13 - SUB", _begin, _end, 0x000FA0FF },
-	{ "test14 - TEST", _begin, _end, 0x0001 },
-	{ NULL, NULL, NULL, -1 }
+	{ "test1 - MOV", _begin, _end, 0x3004, 0 },
+	{ "test2 - OR",  _begin, _end, 0x16FF, 0 },
+	{ "test3 - AND", _begin, _end, 0x1FC0, 0 },
+	{ "test4 - XOR", _begin, _end, 0x10CF, 0 },
+	{ "test5 - Address Sizes", _begin, _end, 0x1F00, 0 },
+	{ "test6 - DMO", _begin, _end, 0xFFAB, 0 },
+	{ "test7 - STOS", _begin, _end, 0x00123456, 0 },
+	{ "test8 - LODS", _begin, _end, 0x12345678, 0 },
+	{ "test9 - MOVS", _begin, _end, 0x12345678, 0 },
+	{ "test10 - MOVZXB", _begin, _end, 0x0078, 0 },
+	{ "test11 - MOVZXW", _begin, _end, 0x5678, 0 },
+	{ "test12 - CMP", _begin, _end, 0x0001, 0 },
+	{ "test13 - SUB", _begin, _end, 0x000FA0FF, 0 },
+	{ "test14 - TEST", _begin, _end, 0x0001, 0 },
+	{ NULL, NULL, NULL, -1, 0 }
 };
 
 static void