reactos/ntoskrnl/ke/i386
diff -u -r1.1 -r1.2
--- tlbflush.S 13 Oct 2004 02:58:59 -0000 1.1
+++ tlbflush.S 17 Oct 2004 17:28:45 -0000 1.2
@@ -4,16 +4,29 @@
* Chapter 10 - Memory Cache Control. Section 10.9 - Invalidating the Translation Lookaside Buffers
*/
+#include <internal/i386/ke.h>
+
+
.globl _KeFlushCurrentTb@0
-_KeFlushCurrentTb@0:
+_KeFlushCurrentTb@0:
+ /* Check for global page support */
+ testl $X86_FEATURE_PGE, (_Ke386CpuidFlags)
+ jz .L1
+
/* Modifying the PSE, PGE or PAE Flag in CR4 causes the TLB to be flushed */
- andl $0xFFFFFF7F, %eax
- movl %eax, %cr4
- orl $0x80, %eax
- movl %eax, %cr4
+ movl %cr4, %eax
+ andl $~X86_CR4_PGE, %eax
+ movl %eax, %cr4
+ orl $X86_CR4_PGE, %eax
+ movl %eax, %cr4
ret
-
+.L1:
+ /* the old way ... */
+ movl %cr3, %eax
+ movl %eax, %cr3
+ ret
+
reactos/ntoskrnl/include/internal/i386
diff -u -r1.12 -r1.13
--- ke.h 1 Oct 2004 20:09:57 -0000 1.12
+++ ke.h 17 Oct 2004 17:28:45 -0000 1.13
@@ -69,6 +69,15 @@
#define KTRAP_FRAME_RESERVED9 (0x8A)
#define KTRAP_FRAME_SIZE (0x8C)
+#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
+#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
+
+#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */
+#define X86_CR4_PGE 0x00000080 /* enable global pages */
+
+#define X86_FEATURE_PAE 0x00000040 /* physical address extension is present */
+#define X86_FEATURE_PGE 0x00002000 /* Page Global Enable */
+
#ifndef __ASM__
typedef struct _KTRAP_FRAME
@@ -156,15 +165,6 @@
VOID
NtEarlyInitVdm(VOID);
-#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */
-#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */
-
-#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */
-#define X86_CR4_PGE 0x00000080 /* enable global pages */
-
-#define X86_FEATURE_PAE 0x00000040 /* physical address extension is present */
-#define X86_FEATURE_PGE 0x00002000 /* Page Global Enable */
-
#if defined(__GNUC__)
#define Ke386DisableInterrupts() __asm__("cli\n\t");
#define Ke386EnableInterrupts() __asm__("sti\n\t");