2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2018 Joyent, Inc.
16 #include <sys/types.h>
17 #include <sys/sysi86.h>
18 #include <sys/segments.h>
19 #include <sys/segment.h>
29 donothing(void *nothing
)
41 * This first is similar to what sbcl does in some variants. Note the
42 * SDT_MEMRW (not SDT_MEMRWA) so we check that the kernel is forcing the
47 struct ssd ssd
= { sel
, (unsigned long)&foo
, 4096,
48 SDT_MEMRW
| (SEL_UPL
<< 5) | (1 << 7), 0x4 };
50 if (sysi86(SI86DSCR
, &ssd
) < 0)
51 err(-1, "failed to setup segment");
53 __asm__
__volatile__("mov %0, %%fs" : : "r" (sel
));
57 if (sysi86(SI86DSCR
, &ssd
) == 0)
58 errx(-1, "removed in-use segment?");
60 __asm__
__volatile__("mov %0, %%fs" : : "r" (0));
62 if (sysi86(SI86DSCR
, &ssd
) < 0)
63 err(-1, "failed to remove segment");
65 for (int i
= 0; i
< MAXNLDT
; i
++) {
67 (void) sysi86(SI86DSCR
, &ssd
);
70 for (int i
= 0; i
< 10; i
++)
71 (void) pthread_create(&tid
, NULL
, donothing
, NULL
);