Commit 53bf758a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll/tests: Adjust test_extended_context() for Win11 results.

parent 7eaa5119
...@@ -9894,6 +9894,20 @@ static void wait_for_thread_next_suspend(HANDLE thread) ...@@ -9894,6 +9894,20 @@ static void wait_for_thread_next_suspend(HANDLE thread)
#define CONTEXT_NATIVE (CONTEXT_XSTATE & CONTEXT_CONTROL) #define CONTEXT_NATIVE (CONTEXT_XSTATE & CONTEXT_CONTROL)
struct context_parameters
{
ULONG flag;
ULONG supported_flags;
ULONG broken_flags;
ULONG context_length;
ULONG legacy_length;
ULONG context_ex_length;
ULONG align;
ULONG flags_offset;
ULONG xsavearea_offset;
ULONG vector_reg_count;
};
static void test_extended_context(void) static void test_extended_context(void)
{ {
static BYTE except_code_reset_ymm_state[] = static BYTE except_code_reset_ymm_state[] =
...@@ -9915,20 +9929,7 @@ static void test_extended_context(void) ...@@ -9915,20 +9929,7 @@ static void test_extended_context(void)
0xc3, /* ret */ 0xc3, /* ret */
}; };
static const struct static const struct context_parameters context_arch_old[] =
{
ULONG flag;
ULONG supported_flags;
ULONG broken_flags;
ULONG context_length;
ULONG legacy_length;
ULONG context_ex_length;
ULONG align;
ULONG flags_offset;
ULONG xsavearea_offset;
ULONG vector_reg_count;
}
context_arch[] =
{ {
{ {
0x00100000, /* CONTEXT_AMD64 */ 0x00100000, /* CONTEXT_AMD64 */
...@@ -9955,6 +9956,36 @@ static void test_extended_context(void) ...@@ -9955,6 +9956,36 @@ static void test_extended_context(void)
8, 8,
}, },
}; };
static const struct context_parameters context_arch_new[] =
{
{
0x00100000, /* CONTEXT_AMD64 */
0xf800005f,
0xf8000000,
0x4d0, /* sizeof(CONTEXT) */
0x4d0, /* sizeof(CONTEXT) */
0x20, /* sizeof(CONTEXT_EX) */
15,
0x30,
0x100, /* offsetof(CONTEXT, FltSave) */
16,
},
{
0x00010000, /* CONTEXT_X86 */
0xf800007f,
0xf8000000,
0x2cc, /* sizeof(CONTEXT) */
0xcc, /* offsetof(CONTEXT, ExtendedRegisters) */
0x20, /* sizeof(CONTEXT_EX) */
3,
0,
0xcc, /* offsetof(CONTEXT, ExtendedRegisters) */
8,
},
};
const struct context_parameters *context_arch;
const ULONG64 supported_features = 7, supported_compaction_mask = supported_features | ((ULONG64)1 << 63); const ULONG64 supported_features = 7, supported_compaction_mask = supported_features | ((ULONG64)1 << 63);
ULONG expected_length, expected_length_xstate, context_flags, expected_offset; ULONG expected_length, expected_length_xstate, context_flags, expected_offset;
ULONG64 enabled_features, expected_compaction; ULONG64 enabled_features, expected_compaction;
...@@ -10000,7 +10031,15 @@ static void test_extended_context(void) ...@@ -10000,7 +10031,15 @@ static void test_extended_context(void)
ok(ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef, "Got unexpected result ret %#lx, length %#lx.\n", ok(ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef, "Got unexpected result ret %#lx, length %#lx.\n",
ret, length); ret, length);
for (test = 0; test < ARRAY_SIZE(context_arch); ++test) ret = pRtlGetExtendedContextLength(context_arch_new[0].flag, &length);
ok(!ret, "Got %#lx.\n", ret);
if (length == context_arch_new[0].context_length + context_arch_new[0].context_ex_length
+ context_arch_new[0].align)
context_arch = context_arch_new;
else
context_arch = context_arch_old;
for (test = 0; test < 2; ++test)
{ {
expected_length = context_arch[test].context_length + context_arch[test].context_ex_length expected_length = context_arch[test].context_length + context_arch[test].context_ex_length
+ context_arch[test].align; + context_arch[test].align;
...@@ -10031,18 +10070,19 @@ static void test_extended_context(void) ...@@ -10031,18 +10070,19 @@ static void test_extended_context(void)
} }
else else
{ {
ok(ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef, ok((ret == STATUS_INVALID_PARAMETER || ret == STATUS_NOT_SUPPORTED) && length == 0xdeadbeef,
"Got unexpected result ret %#lx, length %#lx, flags 0x%08lx.\n", ret, length, flags); "Got unexpected result ret %#lx, length %#lx, flags 0x%08lx.\n", ret, length, flags);
} }
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
bret = pInitializeContext(NULL, flags, NULL, &length2); bret = pInitializeContext(NULL, flags, NULL, &length2);
ok(!bret && length2 == length && GetLastError() ok(!bret && length2 == length && GetLastError()
== (!ret ? ERROR_INSUFFICIENT_BUFFER : ERROR_INVALID_PARAMETER), == (!ret ? ERROR_INSUFFICIENT_BUFFER
: (ret == STATUS_INVALID_PARAMETER ? ERROR_INVALID_PARAMETER : ERROR_NOT_SUPPORTED)),
"Got unexpected bret %#x, length2 %#lx, GetLastError() %lu, flags %#lx.\n", "Got unexpected bret %#x, length2 %#lx, GetLastError() %lu, flags %#lx.\n",
bret, length2, GetLastError(), flags); bret, length2, GetLastError(), flags);
if (GetLastError() == ERROR_INVALID_PARAMETER) if (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_NOT_SUPPORTED)
continue; continue;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -10074,11 +10114,11 @@ static void test_extended_context(void) ...@@ -10074,11 +10114,11 @@ static void test_extended_context(void)
ok(context_ex->All.Offset == -(int)context_arch[test].context_length, ok(context_ex->All.Offset == -(int)context_arch[test].context_length,
"Got unexpected Offset %ld, flags %#lx.\n", context_ex->All.Offset, flags); "Got unexpected Offset %ld, flags %#lx.\n", context_ex->All.Offset, flags);
/* No extra 8 bytes in x64 CONTEXT_EX here. */ /* No extra 8 bytes in x64 CONTEXT_EX here (before Win11). */
ok(context_ex->All.Length == context_arch[test].context_length + context_arch[1].context_ex_length, ok(context_ex->All.Length == context_arch[test].context_length + context_arch[1].context_ex_length,
"Got unexpected Length %#lx, flags %#lx.\n", context_ex->All.Length, flags); "Got unexpected Length %#lx, flags %#lx.\n", context_ex->All.Length, flags);
ok(context_ex->XState.Offset == 25, ok(context_ex->XState.Offset == context_arch[1].context_ex_length + 1,
"Got unexpected Offset %ld, flags %#lx.\n", context_ex->XState.Offset, flags); "Got unexpected Offset %ld, flags %#lx.\n", context_ex->XState.Offset, flags);
ok(!context_ex->XState.Length, ok(!context_ex->XState.Length,
"Got unexpected Length %#lx, flags %#lx.\n", context_ex->XState.Length, flags); "Got unexpected Length %#lx, flags %#lx.\n", context_ex->XState.Length, flags);
...@@ -10608,8 +10648,7 @@ static void test_extended_context(void) ...@@ -10608,8 +10648,7 @@ static void test_extended_context(void)
*(void **)(call_func_code_set_ymm0 + call_func_offsets.ymm0_save) = data; *(void **)(call_func_code_set_ymm0 + call_func_offsets.ymm0_save) = data;
memcpy(code_mem, call_func_code_set_ymm0, sizeof(call_func_code_set_ymm0)); memcpy(code_mem, call_func_code_set_ymm0, sizeof(call_func_code_set_ymm0));
xs->CompactionMask = 2; xs->CompactionMask = 2;
if (!compaction_enabled) xs->Mask = compaction_enabled ? 2 : 0;
xs->Mask = 0;
context_ex->XState.Length = sizeof(XSTATE); context_ex->XState.Length = sizeof(XSTATE);
bret = func(); bret = func();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment