From 2e6dfbc67da9984300388bb755300b2ee6282877 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 11 May 2006 21:01:29 +0000 Subject: [PATCH] - Thomas Weidenmueller: Fix build by fixing __readcr3 / __readcr4 implementations. svn path=/trunk/; revision=21891 --- reactos/include/ddk/winddk.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/reactos/include/ddk/winddk.h b/reactos/include/ddk/winddk.h index 270c0f56a7a..a8ed3b94344 100644 --- a/reactos/include/ddk/winddk.h +++ b/reactos/include/ddk/winddk.h @@ -10460,11 +10460,29 @@ extern BOOLEAN KdDebuggerEnabled; #endif +#ifdef __GNUC__ + /* Available as intrinsics on MSVC */ -static __inline void _disable(void) {__asm__("cli\n\t");} -static __inline void _enable(void) {__asm__("sti\n\t");} -static __inline __int64 __readcr3(void) {__asm__("mov %cr3, %eax\n\t");} -static __inline __int64 __readcr4(void) {__asm__("mov %cr4, %eax\n\t");} +static __inline void _disable(void) {__asm__ __volatile__("cli\n");} +static __inline void _enable(void) {__asm__ __volatile__("sti\n");} + +static __inline ULONG64 __readcr3(void) +{ + ULONG_PTR Ret; + __asm__ __volatile__("movl %%cr3, %0;\n" + :"=r"(Ret)); + return (ULONG64)Ret; +} + +static __inline ULONG64 __readcr4(void) +{ + ULONG_PTR Ret; + __asm__ __volatile__("movl %%cr4, %0; \n" + :"=r"(Ret)); + return (ULONG64)Ret; +} + +#endif #ifdef __cplusplus }