Commit b07ce099 authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

ntdll/tests: Avoid misaligned load in exception handler code in run_exception_test_flags().

This is required for testing EH behavior on alignment check (#AC) exceptions.
parent 702aeb3a
......@@ -3200,7 +3200,7 @@ static void run_exception_test_flags(void *handler, const void* context,
const void *code, unsigned int code_size,
DWORD access, DWORD handler_flags)
{
unsigned char buf[8 + 6 + 8 + 8];
unsigned char buf[2 + 8 + 2 + 8 + 8];
RUNTIME_FUNCTION runtime_func;
UNWIND_INFO *unwind = (UNWIND_INFO *)buf;
void (*func)(void) = code_mem;
......@@ -3219,11 +3219,13 @@ static void run_exception_test_flags(void *handler, const void* context,
*(ULONG *)&buf[4] = 0x1010;
*(const void **)&buf[8] = context;
/* jmp near */
buf[16] = 0xff;
buf[17] = 0x25;
*(ULONG *)&buf[18] = 0;
*(void **)&buf[22] = handler;
/* movabs $<handler>, %rax */
buf[16] = 0x48;
buf[17] = 0xb8;
*(void **)&buf[18] = handler;
/* jmp *%rax */
buf[26] = 0xff;
buf[27] = 0xe0;
memcpy((unsigned char *)code_mem + 0x1000, buf, sizeof(buf));
memcpy(code_mem, code, code_size);
......
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