Skip to content

Commit 5e92e8c

Browse files
authored
[X86] Fix the implementation of __readcr[4,8]/__writecr[4,8] to work in 64-bit mode (#122238)
According to MSVC, __readcr4/__writecr4 return/use `unsigned __int64`, and are supported on both x86 and x64. While __readcr8/__writecr8 are only supported on x64. So we use __INTPTR_TYPE__ and __int64 respectively. Following: 3cec2a1 Ref.: https://learn.microsoft.com/en-us/cpp/intrinsics/readcr3?view=msvc-170 https://learn.microsoft.com/en-us/cpp/intrinsics/readcr8?view=msvc-170
1 parent f3d6cdc commit 5e92e8c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/Headers/intrin.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ void __outwordstring(unsigned short, unsigned short *, unsigned long);
9494
unsigned long __readcr0(void);
9595
unsigned long __readcr2(void);
9696
unsigned __LPTRINT_TYPE__ __readcr3(void);
97-
unsigned long __readcr4(void);
98-
unsigned long __readcr8(void);
97+
unsigned __LPTRINT_TYPE__ __readcr4(void);
98+
unsigned __int64 __readcr8(void);
9999
unsigned int __readdr(unsigned int);
100100
#ifdef __i386__
101101
unsigned char __readfsbyte(unsigned long);
@@ -124,8 +124,8 @@ void __vmx_vmptrst(unsigned __int64 *);
124124
void __wbinvd(void);
125125
void __writecr0(unsigned int);
126126
void __writecr3(unsigned __INTPTR_TYPE__);
127-
void __writecr4(unsigned int);
128-
void __writecr8(unsigned int);
127+
void __writecr4(unsigned __INTPTR_TYPE__);
128+
void __writecr8(unsigned __int64);
129129
void __writedr(unsigned int, unsigned int);
130130
void __writefsbyte(unsigned long, unsigned char);
131131
void __writefsdword(unsigned long, unsigned long);

0 commit comments

Comments
 (0)