1 /*
2 * Auxiliary printing function for the struct user_desc type.
3 * Used by modify_ldt and xet_thread_area tests.
4 *
5 * Copyright (c) 2018 The strace developers.
6 * All rights reserved.
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11 #include "tests.h"
12
13 #ifdef HAVE_STRUCT_USER_DESC
14
15 # include <asm/ldt.h>
16
17 /**
18 * Print user_desc structure.
19 *
20 * @param us Pointer to struct user_desc to print.
21 * @param entry_str If not NULL, the string is printed as a value of
22 * entry_number field.
23 */
24 static void
25 print_user_desc(struct user_desc *us, const char *entry_str)
26 {
27 if (entry_str)
28 printf("{entry_number=%s", entry_str);
29 else
30 printf("{entry_number=%u", us->entry_number);
31
32 printf(", base_addr=%#08x"
33 ", limit=%#08x"
34 ", seg_32bit=%u"
35 ", contents=%u"
36 ", read_exec_only=%u"
37 ", limit_in_pages=%u"
38 ", seg_not_present=%u"
39 ", useable=%u"
40 # ifdef __x86_64__
41 ", lm=%u"
42 # endif
43 "}",
44 us->base_addr,
45 us->limit,
46 us->seg_32bit,
47 us->contents,
48 us->read_exec_only,
49 us->limit_in_pages,
50 us->seg_not_present,
51 us->useable
52 # ifdef __x86_64__
53 , us->lm
54 # endif
55 );
56 }
57
58 #endif /* HAVE_STRUCT_USER_DESC */