36const char test_title[] =
"Memory operand and segment emulation tests";
40 unsigned long (*
fn)(
unsigned long);
45#define GP EXINFO_SYM(GP, 0)
46#define SS EXINFO_SYM(SS, 0)
51 { stub_none_eax,
"(%eax)",
GP },
52 { stub_none_ecx,
"(%ecx)",
GP },
53 { stub_none_edx,
"(%edx)",
GP },
54 { stub_none_ebx,
"(%ebx)",
GP },
55 { stub_none_esp,
"(%esp)",
SS },
56 { stub_none_ebp,
"(%ebp)",
SS },
57 { stub_none_esi,
"(%esi)",
GP },
58 { stub_none_edi,
"(%edi)",
GP },
61 { stub_es_eax,
"%es:(%eax)",
GP },
62 { stub_es_ecx,
"%es:(%ecx)",
GP },
63 { stub_es_edx,
"%es:(%edx)",
GP },
64 { stub_es_ebx,
"%es:(%ebx)",
GP },
65 { stub_es_esp,
"%es:(%esp)",
GP },
66 { stub_es_ebp,
"%es:(%ebp)",
GP },
67 { stub_es_esi,
"%es:(%esi)",
GP },
68 { stub_es_edi,
"%es:(%edi)",
GP },
71 { stub_cs_eax,
"%cs:(%eax)",
GP },
72 { stub_cs_ecx,
"%cs:(%ecx)",
GP },
73 { stub_cs_edx,
"%cs:(%edx)",
GP },
74 { stub_cs_ebx,
"%cs:(%ebx)",
GP },
75 { stub_cs_esp,
"%cs:(%esp)",
GP },
76 { stub_cs_ebp,
"%cs:(%ebp)",
GP },
77 { stub_cs_esi,
"%cs:(%esi)",
GP },
78 { stub_cs_edi,
"%cs:(%edi)",
GP },
81 { stub_ss_eax,
"%ss:(%eax)",
SS },
82 { stub_ss_ecx,
"%ss:(%ecx)",
SS },
83 { stub_ss_edx,
"%ss:(%edx)",
SS },
84 { stub_ss_ebx,
"%ss:(%ebx)",
SS },
85 { stub_ss_esp,
"%ss:(%esp)",
SS },
86 { stub_ss_ebp,
"%ss:(%ebp)",
SS },
87 { stub_ss_esi,
"%ss:(%esi)",
SS },
88 { stub_ss_edi,
"%ss:(%edi)",
SS },
91 { stub_ds_eax,
"%ds:(%eax)",
GP },
92 { stub_ds_ecx,
"%ds:(%ecx)",
GP },
93 { stub_ds_edx,
"%ds:(%edx)",
GP },
94 { stub_ds_ebx,
"%ds:(%ebx)",
GP },
95 { stub_ds_esp,
"%ds:(%esp)",
GP },
96 { stub_ds_ebp,
"%ds:(%ebp)",
GP },
97 { stub_ds_esi,
"%ds:(%esi)",
GP },
98 { stub_ds_edi,
"%ds:(%edi)",
GP },
101 { stub_fs_eax,
"%fs:(%eax)",
GP },
102 { stub_fs_ecx,
"%fs:(%ecx)",
GP },
103 { stub_fs_edx,
"%fs:(%edx)",
GP },
104 { stub_fs_ebx,
"%fs:(%ebx)",
GP },
105 { stub_fs_esp,
"%fs:(%esp)",
GP },
106 { stub_fs_ebp,
"%fs:(%ebp)",
GP },
107 { stub_fs_esi,
"%fs:(%esi)",
GP },
108 { stub_fs_edi,
"%fs:(%edi)",
GP },
111 { stub_gs_eax,
"%gs:(%eax)",
GP },
112 { stub_gs_ecx,
"%gs:(%ecx)",
GP },
113 { stub_gs_edx,
"%gs:(%edx)",
GP },
114 { stub_gs_ebx,
"%gs:(%ebx)",
GP },
115 { stub_gs_esp,
"%gs:(%esp)",
GP },
116 { stub_gs_ebp,
"%gs:(%ebp)",
GP },
117 { stub_gs_esi,
"%gs:(%esi)",
GP },
118 { stub_gs_edi,
"%gs:(%edi)",
GP },
257 unsigned long addr = (~0ul & ~(~0ul >> 1)) +
GB(1);
265 GDTE_SYM(0, 0x7ffff, COMMON, CODE, DPL3, R, D));
270 GDTE_SYM(0, 0x7ffff, COMMON, DATA, DPL3, B, W));
286 " expected %pe, got %pe\n",
295 " expected %pe, got %pe\n",
static void write_fs(unsigned int fs)
static void write_gs(unsigned int gs)
unsigned long exec_user_ss
unsigned long exec_user_cs
static void update_desc(user_desc *ptr, const user_desc new)
Helper to update a live LDT/GDT entry.
bool xtf_has_fep
Boolean indicating whether generic Force Emulation Prefix support is available for the test to use.
void test_main(void)
To be implemented by each test, as its entry point.
const char test_title[]
The title of the test.
user_desc gdt[NR_GDT_ENTRIES]
unsigned int exinfo_t
Packed exception and error code information.
unsigned long exec_user_param(unsigned long(*fn)(unsigned long), unsigned long p1)
Execute fn(p1) at user privilege, passing its return value back.
#define IS_DEFINED(x)
Evalute whether the CONFIG_ token x is defined.
static const struct test tests[]
#define _p(v)
Express an abitrary integer v as void *.
#define GB(num)
Express num in Gigabytes.
void xtf_failure(const char *fmt,...)
Report a test failure.
void xtf_success(const char *fmt,...)
Report test success.
unsigned long(* fn)(unsigned long)
#define GDTE_SYM(base, limit,...)
As INIT_GDTE_SYM(), but creates a user_desc object.
unsigned long stub_cs_r11(unsigned long)
unsigned long stub_none_rdx(unsigned long)
unsigned long stub_fs_rax(unsigned long)
unsigned long stub_cs_rcx(unsigned long)
unsigned long stub_none_rbx(unsigned long)
unsigned long stub_fs_r15(unsigned long)
unsigned long stub_ss_rdx(unsigned long)
unsigned long stub_gs_rsp(unsigned long)
unsigned long stub_gs_r10(unsigned long)
unsigned long stub_ds_r11(unsigned long)
unsigned long stub_cs_rbp(unsigned long)
unsigned long stub_fs_abs(unsigned long)
unsigned long stub_gs_rdx(unsigned long)
unsigned long stub_none_rdi(unsigned long)
unsigned long stub_gs_rax(unsigned long)
unsigned long stub_none_r9(unsigned long)
unsigned long stub_fs_r14(unsigned long)
unsigned long stub_gs_abs(unsigned long)
unsigned long stub_es_r9(unsigned long)
unsigned long stub_none_rsp(unsigned long)
unsigned long stub_es_rcx(unsigned long)
unsigned long stub_cs_r14(unsigned long)
unsigned long stub_cs_rsi(unsigned long)
unsigned long stub_none_abs(unsigned long)
unsigned long stub_ss_rbp(unsigned long)
unsigned long stub_none_rax(unsigned long)
unsigned long stub_gs_rsi(unsigned long)
unsigned long stub_gs_r8(unsigned long)
unsigned long stub_fs_r10(unsigned long)
unsigned long stub_cs_abs(unsigned long)
unsigned long stub_ss_rcx(unsigned long)
unsigned long stub_fs_r13(unsigned long)
unsigned long stub_ds_rsi(unsigned long)
unsigned long stub_fs_rdx(unsigned long)
unsigned long stub_gs_r12(unsigned long)
unsigned long stub_cs_rsp(unsigned long)
unsigned long stub_gs_rbp(unsigned long)
unsigned long stub_none_r15(unsigned long)
unsigned long stub_ss_rsp(unsigned long)
unsigned long stub_ds_rsp(unsigned long)
unsigned long stub_ds_r15(unsigned long)
unsigned long stub_cs_r10(unsigned long)
unsigned long stub_cs_r13(unsigned long)
unsigned long stub_es_r13(unsigned long)
unsigned long stub_gs_r9(unsigned long)
unsigned long stub_fs_r11(unsigned long)
unsigned long stub_es_rdx(unsigned long)
unsigned long stub_cs_r8(unsigned long)
unsigned long stub_ss_rax(unsigned long)
unsigned long stub_cs_r12(unsigned long)
unsigned long stub_cs_r9(unsigned long)
unsigned long stub_fs_r12(unsigned long)
unsigned long stub_es_rdi(unsigned long)
unsigned long stub_es_r15(unsigned long)
unsigned long stub_fs_rsp(unsigned long)
unsigned long stub_cs_rdx(unsigned long)
unsigned long stub_gs_r15(unsigned long)
unsigned long stub_cs_rbx(unsigned long)
unsigned long stub_fs_rbp(unsigned long)
unsigned long stub_es_abs(unsigned long)
unsigned long stub_ds_r12(unsigned long)
unsigned long stub_gs_rbx(unsigned long)
unsigned long stub_ss_r12(unsigned long)
unsigned long stub_ss_r10(unsigned long)
unsigned long stub_es_r8(unsigned long)
unsigned long stub_ds_abs(unsigned long)
unsigned long stub_ds_rbp(unsigned long)
unsigned long stub_gs_rcx(unsigned long)
unsigned long stub_ds_rcx(unsigned long)
unsigned long stub_none_r8(unsigned long)
unsigned long stub_fs_rsi(unsigned long)
unsigned long stub_ss_rdi(unsigned long)
unsigned long stub_ds_r14(unsigned long)
unsigned long stub_none_r11(unsigned long)
unsigned long stub_fs_r9(unsigned long)
unsigned long stub_none_rsi(unsigned long)
unsigned long stub_gs_r11(unsigned long)
unsigned long stub_none_rcx(unsigned long)
unsigned long stub_es_r11(unsigned long)
unsigned long stub_ds_r13(unsigned long)
unsigned long stub_none_r10(unsigned long)
unsigned long stub_fs_r8(unsigned long)
unsigned long stub_ds_rdi(unsigned long)
unsigned long stub_none_r14(unsigned long)
unsigned long stub_ds_r9(unsigned long)
unsigned long stub_es_rsp(unsigned long)
unsigned long stub_ss_rsi(unsigned long)
unsigned long stub_none_r13(unsigned long)
unsigned long stub_ds_r8(unsigned long)
unsigned long stub_cs_rax(unsigned long)
unsigned long stub_ds_rdx(unsigned long)
unsigned long stub_cs_r15(unsigned long)
unsigned long stub_none_r12(unsigned long)
unsigned long stub_es_rbp(unsigned long)
unsigned long stub_es_rax(unsigned long)
unsigned long stub_ss_r13(unsigned long)
unsigned long stub_ss_abs(unsigned long)
unsigned long stub_ss_r9(unsigned long)
unsigned long stub_cs_rdi(unsigned long)
unsigned long stub_fs_rbx(unsigned long)
unsigned long stub_ds_rbx(unsigned long)
unsigned long stub_ds_r10(unsigned long)
unsigned long stub_ss_r8(unsigned long)
unsigned long stub_gs_r13(unsigned long)
unsigned long stub_fs_rdi(unsigned long)
unsigned long stub_ss_r15(unsigned long)
unsigned long stub_es_r14(unsigned long)
unsigned long stub_ss_r11(unsigned long)
unsigned long stub_es_rbx(unsigned long)
unsigned long stub_fs_rcx(unsigned long)
unsigned long stub_ds_rax(unsigned long)
unsigned long stub_ss_r14(unsigned long)
unsigned long stub_none_rbp(unsigned long)
unsigned long stub_es_r12(unsigned long)
unsigned long stub_es_r10(unsigned long)
unsigned long stub_gs_r14(unsigned long)
unsigned long stub_gs_rdi(unsigned long)
unsigned long stub_ss_rbx(unsigned long)
unsigned long stub_es_rsi(unsigned long)