Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/winecrt0/arm64ec.c
12343 views
1
/*
2
* Arm64EC support
3
*
4
* Copyright 2023 Jacek Caban for CodeWeavers
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19
*/
20
21
#ifdef __arm64ec__
22
23
#include "windef.h"
24
#include "winnt.h"
25
#include "wine/asm.h"
26
27
void *__os_arm64x_check_icall_cfg = 0;
28
void *__os_arm64x_dispatch_call_no_redirect = 0;
29
void *__os_arm64x_dispatch_fptr = 0;
30
void *__os_arm64x_dispatch_ret = 0;
31
void *__os_arm64x_get_x64_information = 0;
32
void *__os_arm64x_set_x64_information = 0;
33
34
void *__os_arm64x_helper3 = 0;
35
void *__os_arm64x_helper4 = 0;
36
void *__os_arm64x_helper5 = 0;
37
void *__os_arm64x_helper6 = 0;
38
void *__os_arm64x_helper7 = 0;
39
void *__os_arm64x_helper8 = 0;
40
41
void *__guard_check_icall_fptr = 0;
42
void *__guard_dispatch_icall_fptr = 0;
43
44
asm( ".section .data,\"drw\"\n"
45
".balign 8\n"
46
".globl __os_arm64x_dispatch_icall\n"
47
"__os_arm64x_dispatch_icall:\n"
48
".globl __os_arm64x_check_icall\n"
49
"__os_arm64x_check_icall:\n"
50
".xword 0\n"
51
".globl __os_arm64x_dispatch_call\n"
52
"__os_arm64x_dispatch_call:\n"
53
".globl __os_arm64x_check_call\n"
54
"__os_arm64x_check_call:\n"
55
".xword 0\n" );
56
57
__ASM_GLOBAL_FUNC( __icall_helper_arm64ec,
58
"stp fp, lr, [sp, #-0x10]!\n\t"
59
".seh_save_fplr_x 16\n\t"
60
"mov fp, sp\n\t"
61
".seh_set_fp\n\t"
62
".seh_endprologue\n\t"
63
"adrp x16, __os_arm64x_dispatch_icall\n\t"
64
"ldr x16, [x16, #:lo12:__os_arm64x_dispatch_icall]\n\t"
65
"blr x16\n\t"
66
".seh_startepilogue\n\t"
67
"ldp fp, lr, [sp], #0x10\n\t"
68
".seh_save_fplr_x 0x10\n\t"
69
".seh_endepilogue\n\t"
70
"br x11" )
71
72
asm( "\t.section .rdata,\"dr\"\n"
73
"\t.globl __chpe_metadata\n"
74
"\t.balign 4\n"
75
"__chpe_metadata:\n"
76
"\t.word 2\n"
77
"\t.rva __hybrid_code_map\n"
78
"\t.word __hybrid_code_map_count\n"
79
"\t.rva __x64_code_ranges_to_entry_points\n"
80
"\t.rva __arm64x_redirection_metadata\n"
81
"\t.rva __os_arm64x_dispatch_call_no_redirect\n"
82
"\t.rva __os_arm64x_dispatch_ret\n"
83
"\t.rva __os_arm64x_check_call\n"
84
"\t.rva __os_arm64x_check_icall\n"
85
"\t.rva __os_arm64x_check_icall_cfg\n"
86
"\t.rva __arm64x_native_entrypoint\n"
87
"\t.rva __hybrid_auxiliary_iat\n"
88
"\t.word __x64_code_ranges_to_entry_points_count\n"
89
"\t.word __arm64x_redirection_metadata_count\n"
90
"\t.rva __os_arm64x_get_x64_information\n"
91
"\t.rva __os_arm64x_set_x64_information\n"
92
"\t.rva __arm64x_extra_rfe_table\n"
93
"\t.word __arm64x_extra_rfe_table_size\n"
94
"\t.rva __os_arm64x_dispatch_fptr\n"
95
"\t.rva __hybrid_auxiliary_iat_copy\n"
96
"\t.rva __hybrid_auxiliary_delayload_iat\n"
97
"\t.rva __hybrid_auxiliary_delayload_iat_copy\n"
98
"\t.word __hybrid_image_info_bitfield\n"
99
"\t.rva __os_arm64x_helper3\n"
100
"\t.rva __os_arm64x_helper4\n"
101
"\t.rva __os_arm64x_helper5\n"
102
"\t.rva __os_arm64x_helper6\n"
103
"\t.rva __os_arm64x_helper7\n"
104
"\t.rva __os_arm64x_helper8\n" );
105
106
#endif /* __arm64ec__ */
107
108