Commit daea0b9b authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Allocate the data structure and stack for the ARM64EC emulator.

parent 5eb46419
......@@ -1218,6 +1218,24 @@ NTSTATUS init_thread_stack( TEB *teb, ULONG_PTR limit, SIZE_T reserve_size, SIZE
#endif
}
#ifdef __aarch64__
if (is_arm64ec())
{
CHPE_V2_CPU_AREA_INFO *cpu_area;
const SIZE_T chpev2_stack_size = 0x40000;
/* emulator stack */
if ((status = virtual_alloc_thread_stack( &stack, limit_4g, 0, chpev2_stack_size, chpev2_stack_size, FALSE )))
return status;
cpu_area = stack.DeallocationStack;
cpu_area->ContextAmd64 = (ARM64EC_NT_CONTEXT *)&cpu_area->EmulatorDataInline;
cpu_area->EmulatorStackBase = (ULONG_PTR)stack.StackBase;
cpu_area->EmulatorStackLimit = (ULONG_PTR)stack.StackLimit + page_size;
teb->ChpeV2CpuAreaInfo = cpu_area;
}
#endif
/* native stack */
if ((status = virtual_alloc_thread_stack( &stack, 0, limit, reserve_size, commit_size, TRUE )))
return status;
......
......@@ -3758,6 +3758,13 @@ void virtual_free_teb( TEB *teb )
size = 0;
NtFreeVirtualMemory( GetCurrentProcess(), &teb->DeallocationStack, &size, MEM_RELEASE );
}
#ifdef __aarch64__
if (teb->ChpeV2CpuAreaInfo)
{
size = 0;
NtFreeVirtualMemory( GetCurrentProcess(), (void **)&teb->ChpeV2CpuAreaInfo, &size, MEM_RELEASE );
}
#endif
if (thread_data->kernel_stack)
{
size = 0;
......
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