winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
July
June
May
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
February 2024
----- 2025 -----
July 2025
June 2025
May 2025
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
716 discussions
Start a n
N
ew thread
Paul Gofman : ntdll: Don't hardcode xstate size in syscall frame.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: 7ae488a2bb58501684c6475d4942277b852475fc URL:
https://gitlab.winehq.org/wine/wine/-/commit/7ae488a2bb58501684c6475d494227…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Wed Jan 31 16:12:58 2024 -0600 ntdll: Don't hardcode xstate size in syscall frame. --- dlls/ntdll/unix/signal_i386.c | 53 ++++++++++---------- dlls/ntdll/unix/signal_x86_64.c | 104 ++++++++++++++++++++++++---------------- dlls/ntdll/unix/system.c | 21 ++++++++ dlls/ntdll/unix/unix_private.h | 3 ++ include/winnt.h | 8 ++++ 5 files changed, 123 insertions(+), 66 deletions(-)
1
0
0
0
Paul Gofman : ntdll: Don't hardcode xstate feature mask.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: 1e0728c5d48d87b38c54f655702bf2e639aa4f34 URL:
https://gitlab.winehq.org/wine/wine/-/commit/1e0728c5d48d87b38c54f655702bf2…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Wed Jan 31 14:24:24 2024 -0600 ntdll: Don't hardcode xstate feature mask. --- dlls/ntdll/unix/signal_i386.c | 61 +++++++++++++++++++++-------------------- dlls/ntdll/unix/signal_x86_64.c | 61 ++++++++++++++++++++++++++--------------- dlls/ntdll/unix/system.c | 4 +++ dlls/ntdll/unix/unix_private.h | 9 ++++++ 4 files changed, 84 insertions(+), 51 deletions(-)
1
0
0
0
Alexandre Julliard : ntdll: Always set non-volatile pointers for ARM64 unwinding.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: af4ef5fa02a1f30f15db0f1724fc3efc045f2757 URL:
https://gitlab.winehq.org/wine/wine/-/commit/af4ef5fa02a1f30f15db0f1724fc3e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 16 17:12:02 2024 +0100 ntdll: Always set non-volatile pointers for ARM64 unwinding. --- dlls/ntdll/tests/exception.c | 59 ++++++++++++++++++++++++++------------------ dlls/ntdll/unwind.c | 13 +++++++--- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 85d3d139e55..722f3126278 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -8119,6 +8119,7 @@ struct unwind_test const struct results *results; unsigned int nb_results; int unwound_clear; + int last_set_reg_ptr; }; enum regs @@ -8170,7 +8171,7 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) for (i = 0; i < test->nb_results; i++) { winetest_push_context( "%u/%u", testnum, i ); - memset( &ctx_ptr, 0, sizeof(ctx_ptr) ); + memset( &ctx_ptr, 0x55, sizeof(ctx_ptr) ); memset( &context, 0x55, sizeof(context) ); memset( &unset_reg, 0x55, sizeof(unset_reg) ); for (j = 0; j < 256; j++) fake_stack[j] = j * 8; @@ -8255,17 +8256,27 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) if (test->results[i].regs[k][0] == j) break; } - if (regptr) - ok( k < nb_regs, "register %s should not be set to %llx\n", reg_names[j], regval ); - if (k < nb_regs) { ok( regval == test->results[i].regs[k][1], "register %s wrong %llx/%llx\n", reg_names[j], regval, test->results[i].regs[k][1] ); + if (regptr) + { + if (test->last_set_reg_ptr && j > test->last_set_reg_ptr && j <= 30) + ok( regptr == (void *)unset_reg, "register %s should not have pointer set\n", reg_names[j] ); + else + { + ok( regptr != (void *)unset_reg, "register %s should have pointer set\n", reg_names[j] ); + if (regptr != (void *)unset_reg) + ok( *regptr == regval, "register %s should have reg pointer to %llx / %llx\n", + reg_names[j], *regptr, regval ); + } + } } else { ok( k == nb_regs, "register %s should be set\n", reg_names[j] ); + ok( !regptr || regptr == (void *)unset_reg, "register %s should not have pointer set\n", reg_names[j] ); if (j == lr) ok( context.Lr == ORIG_LR, "register lr wrong %llx/unset\n", context.Lr ); else if (j == x29) @@ -9052,26 +9063,26 @@ static void test_virtual_unwind(void) static const struct unwind_test tests[] = { -#define TEST(func, unwind, unwind_packed, results, unwound_clear) \ - { func, sizeof(func), unwind, unwind_packed ? 0 : sizeof(unwind), results, ARRAY_SIZE(results), unwound_clear } - TEST(function_0, unwind_info_0, 0, results_0, 0), - TEST(function_1, unwind_info_1, 1, results_1, 0), - TEST(function_2, unwind_info_2, 0, results_2, 1), - TEST(function_3, unwind_info_3, 0, results_3, 1), - TEST(function_4, unwind_info_4, 0, results_4, 0), - TEST(function_5, unwind_info_5, 0, results_5, 0), - TEST(function_6, unwind_info_6, 1, results_6, 0), - TEST(function_7, unwind_info_7, 1, results_7, 0), - TEST(function_8, unwind_info_8, 1, results_8, 0), - TEST(function_9, unwind_info_9, 1, results_9, 0), - TEST(function_10, unwind_info_10, 1, results_10, 0), - TEST(function_11, unwind_info_11, 1, results_11, 0), - TEST(function_12, unwind_info_12, 1, results_12, 0), - TEST(function_13, unwind_info_13, 1, results_13, 0), - TEST(function_14, unwind_info_14, 0, results_14, 0), - TEST(function_15, unwind_info_15, 0, results_15, 0), - TEST(function_16, unwind_info_16, 0, results_16, 1), - TEST(function_17, unwind_info_17, 0, results_17, 2), +#define TEST(func, unwind, unwind_packed, results, unwound_clear, last_ptr) \ + { func, sizeof(func), unwind, unwind_packed ? 0 : sizeof(unwind), results, ARRAY_SIZE(results), unwound_clear, last_ptr } + TEST(function_0, unwind_info_0, 0, results_0, 0, 0), + TEST(function_1, unwind_info_1, 1, results_1, 0, 0), + TEST(function_2, unwind_info_2, 0, results_2, 1, 0), + TEST(function_3, unwind_info_3, 0, results_3, 1, x28), + TEST(function_4, unwind_info_4, 0, results_4, 0, 0), + TEST(function_5, unwind_info_5, 0, results_5, 0, 0), + TEST(function_6, unwind_info_6, 1, results_6, 0, 0), + TEST(function_7, unwind_info_7, 1, results_7, 0, 0), + TEST(function_8, unwind_info_8, 1, results_8, 0, 0), + TEST(function_9, unwind_info_9, 1, results_9, 0, 0), + TEST(function_10, unwind_info_10, 1, results_10, 0, 0), + TEST(function_11, unwind_info_11, 1, results_11, 0, 0), + TEST(function_12, unwind_info_12, 1, results_12, 0, 0), + TEST(function_13, unwind_info_13, 1, results_13, 0, 0), + TEST(function_14, unwind_info_14, 0, results_14, 0, 0), + TEST(function_15, unwind_info_15, 0, results_15, 0, 0), + TEST(function_16, unwind_info_16, 0, results_16, 1, x18), + TEST(function_17, unwind_info_17, 0, results_17, 2, 0), #undef TEST }; unsigned int i; diff --git a/dlls/ntdll/unwind.c b/dlls/ntdll/unwind.c index a7cd28785b8..5c8a01e4e8a 100644 --- a/dlls/ntdll/unwind.c +++ b/dlls/ntdll/unwind.c @@ -388,7 +388,7 @@ static void do_pac_auth( ARM64_NT_CONTEXT *context ) static void process_unwind_codes( BYTE *ptr, BYTE *end, ARM64_NT_CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS_ARM64 *ptrs, int skip ) { - unsigned int val, len, save_next = 2; + unsigned int i, val, len, save_next = 2; /* skip codes */ while (ptr < end && skip) @@ -473,6 +473,11 @@ static void process_unwind_codes( BYTE *ptr, BYTE *end, ARM64_NT_CONTEXT *contex ARM64_NT_CONTEXT *src_ctx = (ARM64_NT_CONTEXT *)context->Sp; *context = *src_ctx; context->ContextFlags = flags | (src_ctx->ContextFlags & CONTEXT_UNWOUND_TO_CALL); + if (ptrs) + { + for (i = 19; i < 29; i++) (&ptrs->X19)[i - 19] = &src_ctx->X[i]; + for (i = 8; i < 16; i++) (&ptrs->D8)[i - 8] = &src_ctx->V[i].Low; + } } else if (*ptr == 0xeb) /* MSFT_OP_EC_CONTEXT */ { @@ -480,6 +485,7 @@ static void process_unwind_codes( BYTE *ptr, BYTE *end, ARM64_NT_CONTEXT *contex ARM64EC_NT_CONTEXT *src_ctx = (ARM64EC_NT_CONTEXT *)context->Sp; context_x64_to_arm( context, src_ctx ); context->ContextFlags = flags | (src_ctx->ContextFlags & CONTEXT_UNWOUND_TO_CALL); + if (ptrs) for (i = 8; i < 16; i++) (&ptrs->D8)[i - 8] = &src_ctx->V[i].Low; } else if (*ptr == 0xec) /* MSFT_OP_CLEAR_UNWOUND_TO_CALL */ { @@ -562,10 +568,9 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, ARM64_RUNTIME_FUN { if (func->CR == 3 || func->CR == 2) { - DWORD64 *fp = (DWORD64 *) context->Fp; /* X[29] */ + /* mov x29,sp */ context->Sp = context->Fp; - context->X[29] = fp[0]; - context->X[30] = fp[1]; + restore_regs( 29, 2, 0, context, ptrs ); } context->Sp += local_size; if (fp_size) restore_fpregs( 8, fp_regs, int_regs, context, ptrs );
1
0
0
0
Alexandre Julliard : ntdll: Implement CLEAR_UNWOUND_TO_CALL unwinding operation on ARM64.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: 14a290e77da9d7d644c95015a980e7d65d4a23fc URL:
https://gitlab.winehq.org/wine/wine/-/commit/14a290e77da9d7d644c95015a980e7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 16 15:48:44 2024 +0100 ntdll: Implement CLEAR_UNWOUND_TO_CALL unwinding operation on ARM64. --- dlls/ntdll/tests/exception.c | 83 ++++++++++++++++++++++++++++++++++---------- dlls/ntdll/unwind.c | 26 +++++++++----- 2 files changed, 82 insertions(+), 27 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 41bf0a2d273..85d3d139e55 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -8118,6 +8118,7 @@ struct unwind_test size_t unwind_size; const struct results *results; unsigned int nb_results; + int unwound_clear; }; enum regs @@ -8177,6 +8178,9 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) context.Sp = (ULONG_PTR)fake_stack; context.Lr = (ULONG_PTR)ORIG_LR; context.Fp = (ULONG_PTR)fake_stack + test->results[i].fp_offset; + context.ContextFlags = 0xcccc; + if (test->unwound_clear) context.ContextFlags |= CONTEXT_ARM64_UNWOUND_TO_CALL; + orig_fp = context.Fp; orig_pc = (ULONG64)code_mem + code_offset + test->results[i].pc_offset; @@ -8204,6 +8208,12 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) (void *)context.Pc, (void*)test->results[i].pc ); ok( frame == (test->results[i].frame_offset ? (ULONG64)fake_stack : 0) + test->results[i].frame, "wrong frame %p/%p\n", (void *)frame, (char *)(test->results[i].frame_offset ? fake_stack : NULL) + test->results[i].frame ); + if (!test->unwound_clear || i < test->unwound_clear) + ok( context.ContextFlags == (0xcccc | CONTEXT_ARM64_UNWOUND_TO_CALL), + "wrong flags %lx\n", context.ContextFlags ); + else + ok( context.ContextFlags == 0xcccc, + "wrong flags %lx\n", context.ContextFlags ); sp_offset = 0; for (k = 0; k < nb_regs; k++) @@ -9006,27 +9016,62 @@ static void test_virtual_unwind(void) { 0x10, 0x00, 0 , 0x0108, 0x0b8, FALSE, { {x0, 0x90}, {x1, 0x98}, {x2, 0xc8}, {x3, 0xd0}, {x4, 0xd8}, {x5, 0xe0}, {x6, 0x140}, {x7, 0x150}, {x8, 0x88}, {x9, 0x160}, {x10, 0x170}, {x11, 0x180}, {x12, 0x190}, {x13, 0}, {x14, 0}, {x15, 0x1a0}, {x16, 0x0168015801480138}, {x17, 0x01a8019801880178}, {x18, 0}, {x19, 0xe8}, {x20, 0xf0}, {x21, 0xf8}, {x22, 0x100}, {x23, 0}, {x24, 0}, {x25, 0xb8}, {x26, 0xc0}, {x27, 0xa0}, {x28, 0}, {x29, 0xb0}, {lr, 0x130}, {d0, 0x1b0}, {d1, 0x1c0}, {d2, 0x1d0}, {d3, 0x1e0}, {d4, 0x1f0}, {d5, 0x200}, {d6, 0x210}, {d7, 0x220}, {d8, 0x230}, {d9, 0x240}, {d10, 0x250}, {d11, 0x260}, {d12, 0x270}, {d13, 0x280}, {d14, 0x290}, {d15, 0x2a0}, {-1,-1} }}, }; + static const BYTE function_17[] = + { + 0xff, 0x43, 0x00, 0xd1, /* 00: sub sp, sp, #16 */ + 0xff, 0x43, 0x00, 0xd1, /* 04: sub sp, sp, #16 */ + 0x1f, 0x20, 0x03, 0xd5, /* 08: nop */ + 0xc0, 0x03, 0x5f, 0xd6, /* 0c: ret */ + }; + + static const DWORD unwind_info_17_header = + (sizeof(function_17)/4) | /* function length */ + (0 << 20) | /* X */ + (0 << 21) | /* E */ + (0 << 22) | /* epilog */ + (1 << 27); /* codes */ + + static const BYTE unwind_info_17[] = + { + DW(unwind_info_17_header), + + UWOP_CLEAR_UNWOUND_TO_CALL, + UWOP_ALLOC_SMALL(16), /* sub sp, sp, #16 */ + UWOP_ALLOC_SMALL(16), /* sub sp, sp, #16 */ + UWOP_END, + }; + + static const struct results results_17[] = + { + /* offset fp handler pc frame offset registers */ + { 0x00, 0x00, 0, ORIG_LR, 0x010, TRUE, { {-1,-1} }}, + { 0x04, 0x00, 0, ORIG_LR, 0x020, TRUE, { {-1,-1} }}, + { 0x08, 0x00, 0, ORIG_LR, 0x020, TRUE, { {-1,-1} }}, + { 0x0c, 0x00, 0, ORIG_LR, 0x020, TRUE, { {-1,-1} }}, + }; + static const struct unwind_test tests[] = { -#define TEST(func, unwind, unwind_packed, results) \ - { func, sizeof(func), unwind, unwind_packed ? 0 : sizeof(unwind), results, ARRAY_SIZE(results) } - TEST(function_0, unwind_info_0, 0, results_0), - TEST(function_1, unwind_info_1, 1, results_1), - TEST(function_2, unwind_info_2, 0, results_2), - TEST(function_3, unwind_info_3, 0, results_3), - TEST(function_4, unwind_info_4, 0, results_4), - TEST(function_5, unwind_info_5, 0, results_5), - TEST(function_6, unwind_info_6, 1, results_6), - TEST(function_7, unwind_info_7, 1, results_7), - TEST(function_8, unwind_info_8, 1, results_8), - TEST(function_9, unwind_info_9, 1, results_9), - TEST(function_10, unwind_info_10, 1, results_10), - TEST(function_11, unwind_info_11, 1, results_11), - TEST(function_12, unwind_info_12, 1, results_12), - TEST(function_13, unwind_info_13, 1, results_13), - TEST(function_14, unwind_info_14, 0, results_14), - TEST(function_15, unwind_info_15, 0, results_15), - TEST(function_16, unwind_info_16, 0, results_16), +#define TEST(func, unwind, unwind_packed, results, unwound_clear) \ + { func, sizeof(func), unwind, unwind_packed ? 0 : sizeof(unwind), results, ARRAY_SIZE(results), unwound_clear } + TEST(function_0, unwind_info_0, 0, results_0, 0), + TEST(function_1, unwind_info_1, 1, results_1, 0), + TEST(function_2, unwind_info_2, 0, results_2, 1), + TEST(function_3, unwind_info_3, 0, results_3, 1), + TEST(function_4, unwind_info_4, 0, results_4, 0), + TEST(function_5, unwind_info_5, 0, results_5, 0), + TEST(function_6, unwind_info_6, 1, results_6, 0), + TEST(function_7, unwind_info_7, 1, results_7, 0), + TEST(function_8, unwind_info_8, 1, results_8, 0), + TEST(function_9, unwind_info_9, 1, results_9, 0), + TEST(function_10, unwind_info_10, 1, results_10, 0), + TEST(function_11, unwind_info_11, 1, results_11, 0), + TEST(function_12, unwind_info_12, 1, results_12, 0), + TEST(function_13, unwind_info_13, 1, results_13, 0), + TEST(function_14, unwind_info_14, 0, results_14, 0), + TEST(function_15, unwind_info_15, 0, results_15, 0), + TEST(function_16, unwind_info_16, 0, results_16, 1), + TEST(function_17, unwind_info_17, 0, results_17, 2), #undef TEST }; unsigned int i; diff --git a/dlls/ntdll/unwind.c b/dlls/ntdll/unwind.c index 9e50e0fd67b..a7cd28785b8 100644 --- a/dlls/ntdll/unwind.c +++ b/dlls/ntdll/unwind.c @@ -469,11 +469,22 @@ static void process_unwind_codes( BYTE *ptr, BYTE *end, ARM64_NT_CONTEXT *contex } else if (*ptr == 0xea) /* MSFT_OP_CONTEXT */ { - memcpy( context, (DWORD64 *)context->Sp, sizeof(CONTEXT) ); + DWORD flags = context->ContextFlags & ~CONTEXT_UNWOUND_TO_CALL; + ARM64_NT_CONTEXT *src_ctx = (ARM64_NT_CONTEXT *)context->Sp; + *context = *src_ctx; + context->ContextFlags = flags | (src_ctx->ContextFlags & CONTEXT_UNWOUND_TO_CALL); } else if (*ptr == 0xeb) /* MSFT_OP_EC_CONTEXT */ { - context_x64_to_arm( context, (ARM64EC_NT_CONTEXT *)context->Sp ); + DWORD flags = context->ContextFlags & ~CONTEXT_UNWOUND_TO_CALL; + ARM64EC_NT_CONTEXT *src_ctx = (ARM64EC_NT_CONTEXT *)context->Sp; + context_x64_to_arm( context, src_ctx ); + context->ContextFlags = flags | (src_ctx->ContextFlags & CONTEXT_UNWOUND_TO_CALL); + } + else if (*ptr == 0xec) /* MSFT_OP_CLEAR_UNWOUND_TO_CALL */ + { + context->Pc = context->Lr; + context->ContextFlags &= ~CONTEXT_UNWOUND_TO_CALL; } else if (*ptr == 0xfc) /* pac_sign_lr */ { @@ -766,19 +777,16 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG_PTR base, ULONG_PTR pc, TRACE( "type %lx pc %I64x sp %I64x func %I64x\n", type, pc, context->Sp, base + func->BeginAddress ); *handler_data = NULL; + context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL; - context->Pc = 0; if (func->Flag) handler = unwind_packed_data( base, pc, func, context, ctx_ptr ); else handler = unwind_full_data( base, pc, func, context, handler_data, ctx_ptr ); + if (context->ContextFlags & CONTEXT_UNWOUND_TO_CALL) context->Pc = context->Lr; + TRACE( "ret: pc=%I64x lr=%I64x sp=%I64x handler=%p\n", context->Pc, context->Lr, context->Sp, handler ); - if (!context->Pc) - { - context->Pc = context->Lr; - context->ContextFlags |= CONTEXT_UNWOUND_TO_CALL; - } *frame_ret = context->Sp; return handler; } @@ -1798,6 +1806,7 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG64 base, ULONG64 pc, #ifdef __arm64ec__ if (RtlIsEcCode( (void *)pc )) { + DWORD flags = context->ContextFlags & ~CONTEXT_UNWOUND_TO_CALL; ARM64_NT_CONTEXT arm_context; void *ret; @@ -1805,6 +1814,7 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG64 base, ULONG64 pc, ret = RtlVirtualUnwind_arm64( type, base, pc, (ARM64_RUNTIME_FUNCTION *)function, &arm_context, data, frame_ret, NULL ); context_arm_to_x64( (ARM64EC_NT_CONTEXT *)context, &arm_context ); + context->ContextFlags = flags | (arm_context.ContextFlags & CONTEXT_UNWOUND_TO_CALL); return ret; } #endif
1
0
0
0
Alexandre Julliard : ntdll: Implement EC_CONTEXT unwinding operation on ARM64.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: f4ac9b35c2c587919be6c3539dfdd833e200e777 URL:
https://gitlab.winehq.org/wine/wine/-/commit/f4ac9b35c2c587919be6c3539dfdd8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 16 13:06:31 2024 +0100 ntdll: Implement EC_CONTEXT unwinding operation on ARM64. --- dlls/ntdll/tests/exception.c | 38 ++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unwind.c | 4 ++++ 2 files changed, 42 insertions(+) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index a4f1a706c3f..41bf0a2d273 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -8096,6 +8096,7 @@ static void test_collided_unwind(void) #define UWOP_TRAP_FRAME 0xE8 #define UWOP_MACHINE_FRAME 0xE9 #define UWOP_CONTEXT 0xEA +#define UWOP_EC_CONTEXT 0xEB #define UWOP_CLEAR_UNWOUND_TO_CALL 0xEC struct results @@ -8969,6 +8970,42 @@ static void test_virtual_unwind(void) { 0x14, 0x00, 0, 0x08, 0x020, TRUE, { {x29, 0x00}, {lr, 0x08}, {x19,0x10}, {x20,0x18}, {-1,-1} }}, }; + static const BYTE function_16[] = + { + 0xff, 0x43, 0x00, 0xd1, /* 00: sub sp, sp, #16 */ + 0x1f, 0x20, 0x03, 0xd5, /* 04: nop */ + 0xff, 0x43, 0x00, 0xd1, /* 08: sub sp, sp, #16 */ + 0x1f, 0x20, 0x03, 0xd5, /* 0c: nop */ + 0xc0, 0x03, 0x5f, 0xd6, /* 10: ret */ + }; + + static const DWORD unwind_info_16_header = + (sizeof(function_16)/4) | /* function length */ + (0 << 20) | /* X */ + (0 << 21) | /* E */ + (0 << 22) | /* epilog */ + (1 << 27); /* codes */ + + static const BYTE unwind_info_16[] = + { + DW(unwind_info_16_header), + + UWOP_ALLOC_SMALL(16), /* sub sp, sp, #16 */ + UWOP_EC_CONTEXT, + UWOP_ALLOC_SMALL(16), /* sub sp, sp, #16 */ + UWOP_END, + }; + + static const struct results results_16[] = + { + /* offset fp handler pc frame offset registers */ + { 0x00, 0x00, 0, ORIG_LR, 0x010, TRUE, { {-1,-1} }}, + { 0x04, 0x00, 0 , 0x00f8, 0x0a8, FALSE, { {x0, 0x80}, {x1, 0x88}, {x2, 0xb8}, {x3, 0xc0}, {x4, 0xc8}, {x5, 0xd0}, {x6, 0x130}, {x7, 0x140}, {x8, 0x78}, {x9, 0x150}, {x10, 0x160}, {x11, 0x170}, {x12, 0x180}, {x13, 0}, {x14, 0}, {x15, 0x190}, {x16, 0x0158014801380128}, {x17, 0x0198018801780168}, {x18, 0}, {x19, 0xd8}, {x20, 0xe0}, {x21, 0xe8}, {x22, 0x0f0}, {x23, 0}, {x24, 0}, {x25, 0xa8}, {x26, 0xb0}, {x27, 0x90}, {x28, 0}, {x29, 0xa0}, {lr, 0x120}, {d0, 0x1a0}, {d1, 0x1b0}, {d2, 0x1c0}, {d3, 0x1d0}, {d4, 0x1e0}, {d5, 0x1f0}, {d6, 0x200}, {d7, 0x210}, {d8, 0x220}, {d9, 0x230}, {d10, 0x240}, {d11, 0x250}, {d12, 0x260}, {d13, 0x270}, {d14, 0x280}, {d15, 0x290}, {-1,-1} }}, + { 0x08, 0x00, 0 , 0x0108, 0x0b8, FALSE, { {x0, 0x90}, {x1, 0x98}, {x2, 0xc8}, {x3, 0xd0}, {x4, 0xd8}, {x5, 0xe0}, {x6, 0x140}, {x7, 0x150}, {x8, 0x88}, {x9, 0x160}, {x10, 0x170}, {x11, 0x180}, {x12, 0x190}, {x13, 0}, {x14, 0}, {x15, 0x1a0}, {x16, 0x0168015801480138}, {x17, 0x01a8019801880178}, {x18, 0}, {x19, 0xe8}, {x20, 0xf0}, {x21, 0xf8}, {x22, 0x100}, {x23, 0}, {x24, 0}, {x25, 0xb8}, {x26, 0xc0}, {x27, 0xa0}, {x28, 0}, {x29, 0xb0}, {lr, 0x130}, {d0, 0x1b0}, {d1, 0x1c0}, {d2, 0x1d0}, {d3, 0x1e0}, {d4, 0x1f0}, {d5, 0x200}, {d6, 0x210}, {d7, 0x220}, {d8, 0x230}, {d9, 0x240}, {d10, 0x250}, {d11, 0x260}, {d12, 0x270}, {d13, 0x280}, {d14, 0x290}, {d15, 0x2a0}, {-1,-1} }}, + { 0x0c, 0x00, 0 , 0x0108, 0x0b8, FALSE, { {x0, 0x90}, {x1, 0x98}, {x2, 0xc8}, {x3, 0xd0}, {x4, 0xd8}, {x5, 0xe0}, {x6, 0x140}, {x7, 0x150}, {x8, 0x88}, {x9, 0x160}, {x10, 0x170}, {x11, 0x180}, {x12, 0x190}, {x13, 0}, {x14, 0}, {x15, 0x1a0}, {x16, 0x0168015801480138}, {x17, 0x01a8019801880178}, {x18, 0}, {x19, 0xe8}, {x20, 0xf0}, {x21, 0xf8}, {x22, 0x100}, {x23, 0}, {x24, 0}, {x25, 0xb8}, {x26, 0xc0}, {x27, 0xa0}, {x28, 0}, {x29, 0xb0}, {lr, 0x130}, {d0, 0x1b0}, {d1, 0x1c0}, {d2, 0x1d0}, {d3, 0x1e0}, {d4, 0x1f0}, {d5, 0x200}, {d6, 0x210}, {d7, 0x220}, {d8, 0x230}, {d9, 0x240}, {d10, 0x250}, {d11, 0x260}, {d12, 0x270}, {d13, 0x280}, {d14, 0x290}, {d15, 0x2a0}, {-1,-1} }}, + { 0x10, 0x00, 0 , 0x0108, 0x0b8, FALSE, { {x0, 0x90}, {x1, 0x98}, {x2, 0xc8}, {x3, 0xd0}, {x4, 0xd8}, {x5, 0xe0}, {x6, 0x140}, {x7, 0x150}, {x8, 0x88}, {x9, 0x160}, {x10, 0x170}, {x11, 0x180}, {x12, 0x190}, {x13, 0}, {x14, 0}, {x15, 0x1a0}, {x16, 0x0168015801480138}, {x17, 0x01a8019801880178}, {x18, 0}, {x19, 0xe8}, {x20, 0xf0}, {x21, 0xf8}, {x22, 0x100}, {x23, 0}, {x24, 0}, {x25, 0xb8}, {x26, 0xc0}, {x27, 0xa0}, {x28, 0}, {x29, 0xb0}, {lr, 0x130}, {d0, 0x1b0}, {d1, 0x1c0}, {d2, 0x1d0}, {d3, 0x1e0}, {d4, 0x1f0}, {d5, 0x200}, {d6, 0x210}, {d7, 0x220}, {d8, 0x230}, {d9, 0x240}, {d10, 0x250}, {d11, 0x260}, {d12, 0x270}, {d13, 0x280}, {d14, 0x290}, {d15, 0x2a0}, {-1,-1} }}, + }; + static const struct unwind_test tests[] = { #define TEST(func, unwind, unwind_packed, results) \ @@ -8989,6 +9026,7 @@ static void test_virtual_unwind(void) TEST(function_13, unwind_info_13, 1, results_13), TEST(function_14, unwind_info_14, 0, results_14), TEST(function_15, unwind_info_15, 0, results_15), + TEST(function_16, unwind_info_16, 0, results_16), #undef TEST }; unsigned int i; diff --git a/dlls/ntdll/unwind.c b/dlls/ntdll/unwind.c index d6e86dd717a..9e50e0fd67b 100644 --- a/dlls/ntdll/unwind.c +++ b/dlls/ntdll/unwind.c @@ -471,6 +471,10 @@ static void process_unwind_codes( BYTE *ptr, BYTE *end, ARM64_NT_CONTEXT *contex { memcpy( context, (DWORD64 *)context->Sp, sizeof(CONTEXT) ); } + else if (*ptr == 0xeb) /* MSFT_OP_EC_CONTEXT */ + { + context_x64_to_arm( context, (ARM64EC_NT_CONTEXT *)context->Sp ); + } else if (*ptr == 0xfc) /* pac_sign_lr */ { do_pac_auth( context );
1
0
0
0
Alexandre Julliard : ntdll: Move ARM64 context conversion functions to a new header.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: 931c1a6887da46514dbea17866d2010992f0b6c1 URL:
https://gitlab.winehq.org/wine/wine/-/commit/931c1a6887da46514dbea17866d201…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 16 13:03:03 2024 +0100 ntdll: Move ARM64 context conversion functions to a new header. --- dlls/ntdll/ntdll_misc.h | 5 - dlls/ntdll/signal_arm64ec.c | 219 +++---------------------------------------- dlls/ntdll/unwind.c | 5 +- dlls/ntdll/unwind.h | 221 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 237 insertions(+), 213 deletions(-)
1
0
0
0
Alexandre Julliard : ntdll: Ignore home parameters saving when unwinding epilog on ARM64.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: 41d7baa0139252f66042313f366b199e710f7b7b URL:
https://gitlab.winehq.org/wine/wine/-/commit/41d7baa0139252f66042313f366b19…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 16 12:41:03 2024 +0100 ntdll: Ignore home parameters saving when unwinding epilog on ARM64. --- dlls/ntdll/tests/exception.c | 8 ++++---- dlls/ntdll/unwind.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 6fb02a62bc8..a4f1a706c3f 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -8724,10 +8724,10 @@ static void test_virtual_unwind(void) { 0x14, 0x00, 0, ORIG_LR, 0x050, TRUE, { {x19, 0x00}, {-1,-1} }}, { 0x18, 0x00, 0, ORIG_LR, 0x070, TRUE, { {x19, 0x20}, {-1,-1} }}, { 0x1c, 0x00, 0, ORIG_LR, 0x070, TRUE, { {x19, 0x20}, {-1,-1} }}, - { 0x20, 0x00, 0, ORIG_LR, 0x050, TRUE, { {x19, 0x00}, {-1,-1} }}, - { 0x24, 0x00, 0, ORIG_LR, 0x050, TRUE, { {x19, 0x00}, {-1,-1} }}, - { 0x28, 0x00, 0, ORIG_LR, 0x050, TRUE, { {x19, 0x00}, {-1,-1} }}, - { 0x2c, 0x00, 0, ORIG_LR, 0x050, TRUE, { {x19, 0x00}, {-1,-1} }}, + { 0x20, 0x00, 0, ORIG_LR, 0x070, TRUE, { {x19, 0x20}, {-1,-1} }}, + { 0x24, 0x00, 0, ORIG_LR, 0x070, TRUE, { {x19, 0x20}, {-1,-1} }}, + { 0x28, 0x00, 0, ORIG_LR, 0x070, TRUE, { {x19, 0x20}, {-1,-1} }}, + { 0x2c, 0x00, 0, ORIG_LR, 0x070, TRUE, { {x19, 0x20}, {-1,-1} }}, { 0x30, 0x00, 0, ORIG_LR, 0x050, TRUE, { {x19, 0x00}, {-1,-1} }}, { 0x34, 0x00, 0, ORIG_LR, 0x000, TRUE, { {-1,-1} }}, }; diff --git a/dlls/ntdll/unwind.c b/dlls/ntdll/unwind.c index 7ca744bc4f8..f13d3ba09ae 100644 --- a/dlls/ntdll/unwind.c +++ b/dlls/ntdll/unwind.c @@ -489,7 +489,7 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, ARM64_RUNTIME_FUN { int i; unsigned int len, offset, skip = 0; - unsigned int int_size = func->RegI * 8, fp_size = func->RegF * 8, regsave, local_size; + unsigned int int_size = func->RegI * 8, fp_size = func->RegF * 8, h_size = func->H * 4, regsave, local_size; unsigned int int_regs, fp_regs, saved_regs, local_size_regs; TRACE( "function %I64x-%I64x: len=%#x flag=%x regF=%u regI=%u H=%u CR=%u frame=%x\n", @@ -530,14 +530,14 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, ARM64_RUNTIME_FUN if (local_size > 4088) len++; /* sub sp,sp,#4088 */ break; } - len += 4 * func->H; - if (offset < len) /* prolog */ + if (offset < len + h_size) /* prolog */ { - skip = len - offset; + skip = len + h_size - offset; } else if (offset >= func->FunctionLength - (len + 1)) /* epilog */ { skip = offset - (func->FunctionLength - (len + 1)); + h_size = 0; } } } @@ -584,7 +584,7 @@ static void *unwind_packed_data( ULONG_PTR base, ULONG_PTR pc, ARM64_RUNTIME_FUN break; } - if (func->H) pos += 4; + pos += h_size; if (fp_size) {
1
0
0
0
Alexandre Julliard : ntdll/tests: Simplify testing of unwind register values on ARM64.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: 9cc5ed180205c3e03d69f8c61d2f7a051f5b080a URL:
https://gitlab.winehq.org/wine/wine/-/commit/9cc5ed180205c3e03d69f8c61d2f7a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 16 13:59:01 2024 +0100 ntdll/tests: Simplify testing of unwind register values on ARM64. --- dlls/ntdll/tests/exception.c | 92 ++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 55 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 5a9b77c157c..6fb02a62bc8 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -8106,7 +8106,7 @@ struct results ULONG_PTR pc; /* expected final pc value */ int frame; /* expected frame return value */ int frame_offset; /* whether the frame return value is an offset or an absolute value */ - int regs[48][2]; /* expected values for registers */ + ULONG_PTR regs[48][2]; /* expected values for registers */ }; struct unwind_test @@ -8153,7 +8153,7 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) KNONVOLATILE_CONTEXT_POINTERS ctx_ptr; UINT i, j, k; ULONG64 fake_stack[256]; - ULONG64 frame, orig_pc, orig_fp, unset_reg, sp_offset = 0; + ULONG64 frame, orig_pc, orig_fp, unset_reg, sp_offset = 0, regval, *regptr; static const UINT nb_regs = ARRAY_SIZE(test->results[i].regs); memcpy( (char *)code_mem + code_offset, test->function, test->function_size ); @@ -8167,6 +8167,7 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) for (i = 0; i < test->nb_results; i++) { + winetest_push_context( "%u/%u", testnum, i ); memset( &ctx_ptr, 0, sizeof(ctx_ptr) ); memset( &context, 0x55, sizeof(context) ); memset( &unset_reg, 0x55, sizeof(unset_reg) ); @@ -8178,8 +8179,7 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) orig_fp = context.Fp; orig_pc = (ULONG64)code_mem + code_offset + test->results[i].pc_offset; - trace( "%u/%u: pc=%p (%02x) fp=%p sp=%p\n", testnum, i, - (void *)orig_pc, *(UINT *)orig_pc, (void *)orig_fp, (void *)context.Sp ); + trace( "pc=%p (%02x) fp=%p sp=%p\n", (void *)orig_pc, *(UINT *)orig_pc, (void *)orig_fp, (void *)context.Sp ); data = (void *)0xdeadbeef; handler = RtlVirtualUnwind( UNW_FLAG_EHANDLER, (ULONG64)code_mem, orig_pc, @@ -8187,23 +8187,22 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) if (test->results[i].handler > 0) { ok( (char *)handler == (char *)code_mem + 0x200, - "%u/%u: wrong handler %p/%p\n", testnum, i, handler, (char *)code_mem + 0x200 ); + "wrong handler %p/%p\n", handler, (char *)code_mem + 0x200 ); if (handler) ok( *(DWORD *)data == 0x08070605, - "%u/%u: wrong handler data %lx\n", testnum, i, *(DWORD *)data ); + "wrong handler data %lx\n", *(DWORD *)data ); } else { - ok( handler == NULL, "%u/%u: handler %p instead of NULL\n", testnum, i, handler ); - ok( data == (test->results[i].handler < 0 ? - (void *)0xdeadbeef : NULL), - "%u/%u: handler data set to %p/%p\n", testnum, i, data, + ok( handler == NULL, "handler %p instead of NULL\n", handler ); + ok( data == (test->results[i].handler < 0 ? (void *)0xdeadbeef : NULL), + "handler data set to %p/%p\n", data, (test->results[i].handler < 0 ? (void *)0xdeadbeef : NULL) ); } - ok( context.Pc == test->results[i].pc, "%u/%u: wrong pc %p/%p\n", - testnum, i, (void *)context.Pc, (void*)test->results[i].pc ); - ok( frame == (test->results[i].frame_offset ? (ULONG64)fake_stack : 0) + test->results[i].frame, "%u/%u: wrong frame %p/%p\n", - testnum, i, (void *)frame, (char *)(test->results[i].frame_offset ? fake_stack : NULL) + test->results[i].frame ); + ok( context.Pc == test->results[i].pc, "wrong pc %p/%p\n", + (void *)context.Pc, (void*)test->results[i].pc ); + ok( frame == (test->results[i].frame_offset ? (ULONG64)fake_stack : 0) + test->results[i].frame, "wrong frame %p/%p\n", + (void *)frame, (char *)(test->results[i].frame_offset ? fake_stack : NULL) + test->results[i].frame ); sp_offset = 0; for (k = 0; k < nb_regs; k++) @@ -8217,13 +8216,24 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) break; } } - ok( frame - sp_offset == context.Sp, "%u/%u: wrong sp %p/%p\n", - testnum, i, (void *)(frame - sp_offset), (void *)context.Sp); + ok( frame - sp_offset == context.Sp, "wrong sp %p/%p\n", + (void *)(frame - sp_offset), (void *)context.Sp); for (j = 0; j < 48; j++) { if (j == sp) continue; /* Handling sp separately above */ + if (j <= 30) + { + regval = context.X[j]; + regptr = j < 19 ? NULL : (&ctx_ptr.X19)[j - 19]; + } + else + { + regval = context.V[j - d0].Low; + regptr = j < d8 ? NULL : (&ctx_ptr.D8)[j - d8]; + } + for (k = 0; k < nb_regs; k++) { if (test->results[i].regs[k][0] == -1) @@ -8234,54 +8244,26 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) if (test->results[i].regs[k][0] == j) break; } - if (j >= 19 && j <= 30 && (&ctx_ptr.X19)[j - 19]) - { - ok( k < nb_regs, "%u/%u: register %s should not be set to %llx\n", - testnum, i, reg_names[j], context.X[j] ); - if (k < nb_regs) - ok( context.X[j] == test->results[i].regs[k][1], - "%u/%u: register %s wrong %p/%x\n", - testnum, i, reg_names[j], (void *)context.X[j], test->results[i].regs[k][1] ); - } - else if (j >= d8 && j <= d15 && (&ctx_ptr.D8)[j - d8]) + if (regptr) + ok( k < nb_regs, "register %s should not be set to %llx\n", reg_names[j], regval ); + + if (k < nb_regs) { - ok( k < nb_regs, "%u/%u: register %s should not be set to %llx\n", - testnum, i, reg_names[j], context.V[j - d0].Low ); - if (k < nb_regs) - ok( context.V[j - d0].Low == test->results[i].regs[k][1], - "%u/%u: register %s wrong %p/%x\n", - testnum, i, reg_names[j], (void *)context.V[j - d0].Low, test->results[i].regs[k][1] ); - } - else if (k < nb_regs) - { - if (j < d0) - ok( context.X[j] == test->results[i].regs[k][1], - "%u/%u: register %s wrong %p/%x\n", - testnum, i, reg_names[j], (void *)context.X[j], test->results[i].regs[k][1] ); - else - ok( context.V[j - d0].Low == test->results[i].regs[k][1], - "%u/%u: register %s wrong %p/%x\n", - testnum, i, reg_names[j], (void *)context.V[j - d0].Low, test->results[i].regs[k][1] ); + ok( regval == test->results[i].regs[k][1], + "register %s wrong %llx/%llx\n", reg_names[j], regval, test->results[i].regs[k][1] ); } else { - ok( k == nb_regs, "%u/%u: register %s should be set\n", testnum, i, reg_names[j] ); + ok( k == nb_regs, "register %s should be set\n", reg_names[j] ); if (j == lr) - ok( context.Lr == ORIG_LR, "%u/%u: register lr wrong %p/unset\n", - testnum, i, (void *)context.Lr ); + ok( context.Lr == ORIG_LR, "register lr wrong %llx/unset\n", context.Lr ); else if (j == x29) - ok( context.Fp == orig_fp, "%u/%u: register fp wrong %p/unset\n", - testnum, i, (void *)context.Fp ); - else if (j < d0) - ok( context.X[j] == unset_reg, - "%u/%u: register %s wrong %p/unset\n", - testnum, i, reg_names[j], (void *)context.X[j]); + ok( context.Fp == orig_fp, "register fp wrong %llx/unset\n", context.Fp ); else - ok( context.V[j - d0].Low == unset_reg, - "%u/%u: register %s wrong %p/unset\n", - testnum, i, reg_names[j], (void *)context.V[j - d0].Low); + ok( regval == unset_reg, "register %s wrong %llx/unset\n", reg_names[j], regval); } } + winetest_pop_context(); } }
1
0
0
0
Alexandre Julliard : rpcrt4/tests: Fix some malloc/HeapAlloc mismatches.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: 18bdd435f12714859794da49ba52806f37a120f2 URL:
https://gitlab.winehq.org/wine/wine/-/commit/18bdd435f12714859794da49ba5280…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 16 14:23:28 2024 +0100 rpcrt4/tests: Fix some malloc/HeapAlloc mismatches. Fixes regressions caused by a38e05636df9596ff3e41301c771fe93523808f1. --- dlls/rpcrt4/tests/cstub.c | 4 ++-- dlls/rpcrt4/tests/ndr_marshall.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/rpcrt4/tests/cstub.c b/dlls/rpcrt4/tests/cstub.c index 266d34c3c7f..12ea13363b0 100644 --- a/dlls/rpcrt4/tests/cstub.c +++ b/dlls/rpcrt4/tests/cstub.c @@ -62,13 +62,13 @@ static int my_free_called; static void * CALLBACK my_alloc(SIZE_T size) { my_alloc_called++; - return NdrOleAllocate(size); + return malloc(size); } static void CALLBACK my_free(void *ptr) { my_free_called++; - NdrOleFree(ptr); + free(ptr); } typedef struct _MIDL_PROC_FORMAT_STRING diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c index ba9ceaf18fb..d86f3b0556e 100644 --- a/dlls/rpcrt4/tests/ndr_marshall.c +++ b/dlls/rpcrt4/tests/ndr_marshall.c @@ -41,13 +41,13 @@ static int my_free_called; static void * CALLBACK my_alloc(SIZE_T size) { my_alloc_called++; - return NdrOleAllocate(size); + return malloc(size); } static void CALLBACK my_free(void *ptr) { my_free_called++; - NdrOleFree(ptr); + free(ptr); } static const MIDL_STUB_DESC Object_StubDesc = @@ -2222,7 +2222,7 @@ static void test_nonconformant_string(void) ok(mem != mem_orig, "mem not alloced\n"); ok(mem != StubMsg.BufferStart + 8, "mem pointing at buffer\n"); ok(my_alloc_called == 1, "alloc called %d\n", my_alloc_called); - NdrOleFree(mem); + free(mem); my_alloc_called = 0; mem = mem_orig; @@ -2295,7 +2295,7 @@ static void test_nonconformant_string(void) ok(mem != mem_orig, "mem not alloced\n"); ok(mem != StubMsg.BufferStart + 8, "mem pointing at buffer\n"); ok(my_alloc_called == 1, "alloc called %d\n", my_alloc_called); - NdrOleFree(mem); + free(mem); my_alloc_called = 0; mem = mem_orig;
1
0
0
0
Zebediah Figura : wined3d: Use dynamic state for depth/stencil state if possible.
by Alexandre Julliard
16 Feb '24
16 Feb '24
Module: wine Branch: master Commit: 4e74e9dfa97fd4597c900ce16d0f06f1e1362546 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4e74e9dfa97fd4597c900ce16d0f06…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Thu Sep 7 19:19:13 2023 -0500 wined3d: Use dynamic state for depth/stencil state if possible. --- dlls/wined3d/context_vk.c | 73 +++++++++++++++++++++++++++++++++++++++++------ dlls/wined3d/wined3d_vk.h | 8 ++++++ 2 files changed, 72 insertions(+), 9 deletions(-) diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 38f1795c063..a07578a4a1d 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -1878,6 +1878,7 @@ void wined3d_context_vk_submit_command_buffer(struct wined3d_context_vk *context context_invalidate_state(&context_vk->c, STATE_STREAMSRC); context_invalidate_state(&context_vk->c, STATE_INDEXBUFFER); context_invalidate_state(&context_vk->c, STATE_BLEND_FACTOR); + context_invalidate_state(&context_vk->c, STATE_DEPTH_STENCIL); context_invalidate_state(&context_vk->c, STATE_STENCIL_REF); context_invalidate_state(&context_vk->c, STATE_VIEWPORT); context_invalidate_state(&context_vk->c, STATE_SCISSORRECT); @@ -2082,17 +2083,28 @@ static int wined3d_bo_slab_vk_compare(const void *key, const struct wine_rb_entr static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context_vk *context_vk) { + const struct wined3d_vk_info *vk_info = context_vk->vk_info; + VkDynamicState *dynamic_states = context_vk->dynamic_states; struct wined3d_graphics_pipeline_key_vk *key; VkPipelineShaderStageCreateInfo *stage; + uint32_t dynamic_state_count = 0; unsigned int i; - static const VkDynamicState dynamic_states[] = + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_BLEND_CONSTANTS; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_VIEWPORT; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_SCISSOR; + + if (vk_info->supported[WINED3D_VK_EXT_EXTENDED_DYNAMIC_STATE]) { - VK_DYNAMIC_STATE_BLEND_CONSTANTS, - VK_DYNAMIC_STATE_STENCIL_REFERENCE, - VK_DYNAMIC_STATE_VIEWPORT, - VK_DYNAMIC_STATE_SCISSOR, - }; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_OP_EXT; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK; + dynamic_states[dynamic_state_count++] = VK_DYNAMIC_STATE_STENCIL_WRITE_MASK; + } key = &context_vk->graphics.pipeline_key_vk; memset(key, 0, sizeof(*key)); @@ -2137,7 +2149,7 @@ static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context key->blend_desc.blendConstants[3] = 1.0f; key->dynamic_desc.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; - key->dynamic_desc.dynamicStateCount = ARRAY_SIZE(dynamic_states); + key->dynamic_desc.dynamicStateCount = dynamic_state_count; key->dynamic_desc.pDynamicStates = dynamic_states; key->pipeline_desc.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; @@ -2309,6 +2321,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte { unsigned int i, attribute_count, binding_count, divisor_count, stage_count; const struct wined3d_d3d_info *d3d_info = context_vk->c.d3d_info; + const struct wined3d_vk_info *vk_info = context_vk->vk_info; struct wined3d_graphics_pipeline_key_vk *key; VkPipelineShaderStageCreateInfo *stage; struct wined3d_stream_info stream_info; @@ -2471,8 +2484,9 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte update = true; } - if (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_DEPTH_STENCIL) - || wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_FRAMEBUFFER)) + if (!vk_info->supported[WINED3D_VK_EXT_EXTENDED_DYNAMIC_STATE] + && (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_DEPTH_STENCIL) + || wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_FRAMEBUFFER))) { const struct wined3d_depth_stencil_state *d = state->depth_stencil_state; @@ -3795,6 +3809,47 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c VK_CALL(vkCmdSetScissor(vk_command_buffer, 0, viewport_count, scissors)); } + if (vk_info->supported[WINED3D_VK_EXT_EXTENDED_DYNAMIC_STATE] + && (wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_DEPTH_STENCIL) + || wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_FRAMEBUFFER))) + { + const struct wined3d_depth_stencil_state *d = state->depth_stencil_state; + + if (d) + { + VkBool32 stencil_enable = state->fb.depth_stencil && d->desc.stencil; + + VK_CALL(vkCmdSetDepthTestEnableEXT(vk_command_buffer, d->desc.depth)); + VK_CALL(vkCmdSetDepthWriteEnableEXT(vk_command_buffer, d->desc.depth_write)); + VK_CALL(vkCmdSetDepthCompareOpEXT(vk_command_buffer, vk_compare_op_from_wined3d(d->desc.depth_func))); + VK_CALL(vkCmdSetStencilTestEnableEXT(vk_command_buffer, stencil_enable)); + if (stencil_enable) + { + VK_CALL(vkCmdSetStencilOpEXT(vk_command_buffer, VK_STENCIL_FACE_FRONT_BIT, + vk_stencil_op_from_wined3d(d->desc.front.fail_op), + vk_stencil_op_from_wined3d(d->desc.front.pass_op), + vk_stencil_op_from_wined3d(d->desc.front.depth_fail_op), + vk_compare_op_from_wined3d(d->desc.front.func))); + VK_CALL(vkCmdSetStencilOpEXT(vk_command_buffer, VK_STENCIL_FACE_BACK_BIT, + vk_stencil_op_from_wined3d(d->desc.back.fail_op), + vk_stencil_op_from_wined3d(d->desc.back.pass_op), + vk_stencil_op_from_wined3d(d->desc.back.depth_fail_op), + vk_compare_op_from_wined3d(d->desc.back.func))); + VK_CALL(vkCmdSetStencilCompareMask(vk_command_buffer, + VK_STENCIL_FACE_FRONT_AND_BACK, d->desc.stencil_read_mask)); + VK_CALL(vkCmdSetStencilWriteMask(vk_command_buffer, + VK_STENCIL_FACE_FRONT_AND_BACK, d->desc.stencil_write_mask)); + } + } + else + { + VK_CALL(vkCmdSetDepthTestEnableEXT(vk_command_buffer, VK_TRUE)); + VK_CALL(vkCmdSetDepthWriteEnableEXT(vk_command_buffer, VK_TRUE)); + VK_CALL(vkCmdSetDepthCompareOpEXT(vk_command_buffer, VK_COMPARE_OP_LESS)); + VK_CALL(vkCmdSetStencilTestEnableEXT(vk_command_buffer, VK_FALSE)); + } + } + memset(context_vk->c.dirty_graphics_states, 0, sizeof(context_vk->c.dirty_graphics_states)); context_vk->c.shader_update_mask &= 1u << WINED3D_SHADER_TYPE_COMPUTE; diff --git a/dlls/wined3d/wined3d_vk.h b/dlls/wined3d/wined3d_vk.h index f94ba11346c..280f36f692a 100644 --- a/dlls/wined3d/wined3d_vk.h +++ b/dlls/wined3d/wined3d_vk.h @@ -179,6 +179,12 @@ struct wined3d_device_vk; VK_DEVICE_PFN(vkUnmapMemory) \ VK_DEVICE_PFN(vkUpdateDescriptorSets) \ VK_DEVICE_PFN(vkWaitForFences) \ + /* VK_EXT_extended_dynamic_state */ \ + VK_DEVICE_EXT_PFN(vkCmdSetDepthCompareOpEXT) \ + VK_DEVICE_EXT_PFN(vkCmdSetDepthTestEnableEXT) \ + VK_DEVICE_EXT_PFN(vkCmdSetDepthWriteEnableEXT) \ + VK_DEVICE_EXT_PFN(vkCmdSetStencilOpEXT) \ + VK_DEVICE_EXT_PFN(vkCmdSetStencilTestEnableEXT) \ /* VK_EXT_transform_feedback */ \ VK_DEVICE_EXT_PFN(vkCmdBeginQueryIndexedEXT) \ VK_DEVICE_EXT_PFN(vkCmdBeginTransformFeedbackEXT) \ @@ -559,6 +565,8 @@ struct wined3d_context_vk const struct wined3d_vk_info *vk_info; + VkDynamicState dynamic_states[11]; + uint32_t update_compute_pipeline : 1; uint32_t update_stream_output : 1; uint32_t padding : 30;
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
...
72
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Results per page:
10
25
50
100
200