Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libi386 Add a test on the maximum number of slots.
details: https://anonhg.NetBSD.org/src/rev/7dab924934d5
branches: trunk
changeset: 1009539:7dab924934d5
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Apr 26 12:13:10 2020 +0000
description:
Add a test on the maximum number of slots.
diffstat:
tests/lib/libi386/t_user_ldt.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diffs (34 lines):
diff -r 508a8d598904 -r 7dab924934d5 tests/lib/libi386/t_user_ldt.c
--- a/tests/lib/libi386/t_user_ldt.c Sun Apr 26 11:56:38 2020 +0000
+++ b/tests/lib/libi386/t_user_ldt.c Sun Apr 26 12:13:10 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_user_ldt.c,v 1.1 2020/04/19 13:22:58 maxv Exp $ */
+/* $NetBSD: t_user_ldt.c,v 1.2 2020/04/26 12:13:10 maxv Exp $ */
/*
* Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -42,6 +42,10 @@
#include <machine/sysarch.h>
#include <machine/vmparam.h>
+#define _LOCORE /* XXX a bit of a hack, but whatever */
+#include <machine/gdt.h>
+#undef _LOCORE
+
#include <atf-c.h>
static uint8_t *ldt_base;
@@ -166,6 +170,13 @@
ATF_REQUIRE_EQ(i386_set_ldt(256, &desc, 1), -1);
ATF_REQUIRE_EQ(errno, EACCES);
}
+
+ /* Check the slot limit. */
+ build_desc(&desc, ldt_base, PAGE_SIZE, SDT_MEMRW, SEL_UPL, 1, 0);
+ ATF_REQUIRE_EQ(i386_set_ldt(MAX_USERLDT_SLOTS-1, &desc, 1),
+ MAX_USERLDT_SLOTS-1);
+ ATF_REQUIRE_EQ(i386_set_ldt(MAX_USERLDT_SLOTS, &desc, 1), -1);
+ ATF_REQUIRE_EQ(errno, EINVAL);
}
/* -------------------------------------------------------------------------- */
Home |
Main Index |
Thread Index |
Old Index