[prev in list] [next in list] [prev in thread] [next in thread]
List: ros-diffs
Subject: [ros-diffs] [hbirr] 19764: - Used the already detected cache line
From: <hbirr () svn ! reactos ! com>
Date: 2005-11-30 0:26:08
Message-ID: 000001c5f544$a8a209a0$6b01a8c0 () PENELOPE
[Download RAW message or body]
- Used the already detected cache line size for
RtlPrefetchMemoryNonTemporal.
- Initialized RtlPrefetchMemoryNonTemporal earlier.
- Change the memory protection during the initialisation of
RtlPrefetchMemoryNonTemporal.
Modified: trunk/reactos/lib/rtl/i386/mem_asm.S
Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c
_____
Modified: trunk/reactos/lib/rtl/i386/mem_asm.S
--- trunk/reactos/lib/rtl/i386/mem_asm.S 2005-11-30 00:17:14 UTC
(rev 19763)
+++ trunk/reactos/lib/rtl/i386/mem_asm.S 2005-11-30 00:25:48 UTC
(rev 19764)
@@ -151,13 +151,12 @@
@RtlPrefetchMemoryNonTemporal@8:
ret /* Overwritten by ntoskrnl/ke/i386/kernel.c if SSE
is supported (see Ki386SetProcessorFeatures() ) */
- mov eax, [_Ke386CacheGranularity] // Get cache line size
+ mov eax, [_Ke386CacheAlignment] // Get cache line size
// This is fastcall, so ecx = address, edx = size
- fetch_next_line:
+fetch_next_line:
prefetchnta byte ptr [ecx] // prefechnta(address)
- sub edx, eax // count = count - cache_line_size
add ecx, eax // address = address +
cache_line_size
- cmp edx, 0 // if(count) > 0
+ sub edx, eax // count = count - cache_line_size
ja fetch_next_line // goto fetch_next_line
ret
_____
Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c
--- trunk/reactos/ntoskrnl/ke/i386/kernel.c 2005-11-30 00:17:14 UTC
(rev 19763)
+++ trunk/reactos/ntoskrnl/ke/i386/kernel.c 2005-11-30 00:25:48 UTC
(rev 19764)
@@ -22,7 +22,6 @@
ULONG Ke386CacheAlignment;
CHAR Ke386CpuidModel[49] = {0,};
ULONG Ke386L1CacheSize;
-ULONG Ke386CacheGranularity = 0x40; /* FIXME: Default to 64 bytes
for RtlPrefetchMemoryNonTemporal(), need real size */
BOOLEAN Ke386NoExecute = FALSE;
BOOLEAN Ke386Pae = FALSE;
BOOLEAN Ke386GlobalPagesEnabled = FALSE;
@@ -418,6 +417,18 @@
/* Target EIP. */
Ke386Wrmsr(0x176, (ULONG_PTR)KiFastCallEntry, 0);
}
+
+ /* Does the CPU Support 'prefetchnta' (SSE) */
+ if(KPCR->PrcbData.FeatureBits & X86_FEATURE_SSE)
+ {
+ ULONG Protect;
+
+ Protect = MmGetPageProtect(NULL,
(PVOID)RtlPrefetchMemoryNonTemporal);
+ MmSetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal,
Protect | PAGE_IS_WRITABLE);
+ /* Replace the ret by a nop */
+ *(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90;
+ MmSetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal,
Protect);
+ }
}
VOID
@@ -523,13 +534,6 @@
SharedUserData->ProcessorFeatures[PF_XMMI64_INSTRUCTIONS_AVAILABLE]
=
(Pcr->PrcbData.FeatureBits & X86_FEATURE_SSE2);
- /* Does the CPU Support 'prefetchnta' (SSE) */
- if(Pcr->PrcbData.FeatureBits & X86_FEATURE_SSE)
- {
- /* Replace the ret by a nop */
- /* FIXME - *(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90; */
- }
-
/* Does the CPU Support Fast System Call? */
if (Pcr->PrcbData.FeatureBits & X86_FEATURE_SYSCALL) {
[Attachment #3 (text/html)]
<html>
<head>
<style>
<!--
body { background-color:#ffffff }
.file { border:1px solid #eeeeee; margin-top:1em; margin-bottom:1em }
.pathname { font-family:monospace; float:right }
.fileheader { margin-bottom:.5em }
.diff { margin:0 }
.tasklist { padding:4px; border:1px dashed #000000; margin-top:1em }
.tasklist ul { margin-top:0; margin-bottom:0 }
tr.alt { background-color:#eeeeee }
#added { background-color:#ddffdd }
#addedchars { background-color:#99ff99; font-weight:bolder }
tr.alt #added { background-color:#ccf7cc }
#removed { background-color:#ffdddd }
#removedchars { background-color:#ff9999; font-weight:bolder }
tr.alt #removed { background-color:#f7cccc }
#info { color:#888888 }
#context { background-color:#eeeeee }
td {padding-left:.3em; padding-right:.3em }
tr.head { border-bottom-width:1px; border-bottom-style:solid }
tr.head td { padding:0; padding-top:.2em }
.task { background-color:#ffff00 }
.comment { padding:4px; border:1px dashed #000000; background-color:#ffffdd }
.error { color:red }
hr { border-width:0px; height:2px; background:black }
-->
</style>
</head>
<body>
<pre class="comment">- Used the already detected cache line size for \
RtlPrefetchMemoryNonTemporal.
- Initialized RtlPrefetchMemoryNonTemporal earlier.
- Change the memory protection during the initialisation of \
RtlPrefetchMemoryNonTemporal.</pre><pre class="diff" id="context">Modified: \
trunk/reactos/lib/rtl/i386/mem_asm.S
Modified: trunk/reactos/ntoskrnl/ke/i386/kernel.c
</pre><hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/lib/rtl/i386/mem_asm.S</b></big></div> <pre class="diff"><small \
id="info">--- trunk/reactos/lib/rtl/i386/mem_asm.S 2005-11-30 00:17:14 UTC (rev \
19763)
+++ trunk/reactos/lib/rtl/i386/mem_asm.S 2005-11-30 00:25:48 UTC (rev 19764)
@@ -151,13 +151,12 @@
</small></pre><pre class="diff" id="context"> @RtlPrefetchMemoryNonTemporal@8:
ret /* Overwritten by ntoskrnl/ke/i386/kernel.c if SSE \
is supported (see Ki386SetProcessorFeatures() ) */
</pre><pre class="diff" id="removed">- mov eax, [_Ke386Cache<span \
id="removedchars">Granularity</span>] // Get cache line size </pre><pre \
class="diff" id="added">+ mov eax, [_Ke386Cache<span \
id="addedchars">Alignment</span>] // Get cache line size </pre><pre \
class="diff" id="context"> // This is fastcall, so ecx = address, edx = size
</pre><pre class="diff" id="removed">-<span \
id="removedchars"> f</span>etch_next_line: </pre><pre class="diff" id="added">+<span \
id="addedchars">f</span>etch_next_line: </pre><pre class="diff" id="context"> \
prefetchnta byte ptr [ecx] // prefechnta(address) </pre><pre class="diff" \
id="removed">- sub edx, eax // \
count = count - cache_line_size </pre><pre class="diff" id="context"> add ecx, eax \
// address = address + \
cache_line_size </pre><pre class="diff" id="removed">- <span id="removedchars">cmp \
edx, 0 // if(count) \
> 0</span> </pre><pre class="diff" id="added">+ <span id="addedchars">sub edx, eax \
// count = count - \
cache_line_size</span> </pre><pre class="diff" id="context"> ja fetch_next_line \
// goto fetch_next_line ret
</pre></div>
<hr /><div class="file">
<div class="fileheader"><big><b>Modified: \
trunk/reactos/ntoskrnl/ke/i386/kernel.c</b></big></div> <pre class="diff"><small \
id="info">--- trunk/reactos/ntoskrnl/ke/i386/kernel.c 2005-11-30 00:17:14 UTC (rev \
19763)
+++ trunk/reactos/ntoskrnl/ke/i386/kernel.c 2005-11-30 00:25:48 UTC (rev 19764)
@@ -22,7 +22,6 @@
</small></pre><pre class="diff" id="context"> ULONG Ke386CacheAlignment;
CHAR Ke386CpuidModel[49] = {0,};
ULONG Ke386L1CacheSize;
</pre><pre class="diff" id="removed">-ULONG Ke386CacheGranularity = 0x40; \
/* FIXME: Default to 64 bytes for RtlPrefetchMemoryNonTemporal(), need \
real size */ </pre><pre class="diff" id="context"> BOOLEAN Ke386NoExecute = FALSE;
BOOLEAN Ke386Pae = FALSE;
BOOLEAN Ke386GlobalPagesEnabled = FALSE;
@@ -418,6 +417,18 @@
</pre><pre class="diff" id="context"> /* Target EIP. */
Ke386Wrmsr(0x176, (ULONG_PTR)KiFastCallEntry, 0);
}
</pre><pre class="diff" id="added">+
+ /* Does the CPU Support 'prefetchnta' (SSE) */
+ if(KPCR->PrcbData.FeatureBits & X86_FEATURE_SSE)
+ {
+ ULONG Protect;
+
+ Protect = MmGetPageProtect(NULL, \
(PVOID)RtlPrefetchMemoryNonTemporal); + MmSetPageProtect(NULL, \
(PVOID)RtlPrefetchMemoryNonTemporal, Protect | PAGE_IS_WRITABLE); + \
/* Replace the ret by a nop */ + \
*(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90; + \
MmSetPageProtect(NULL, (PVOID)RtlPrefetchMemoryNonTemporal, Protect); + }
</pre><pre class="diff" id="context"> }
VOID
@@ -523,13 +534,6 @@
</pre><pre class="diff" id="context"> \
SharedUserData->ProcessorFeatures[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = \
(Pcr->PrcbData.FeatureBits & X86_FEATURE_SSE2);
</pre><pre class="diff" id="removed">- /* Does the CPU Support 'prefetchnta' \
(SSE) */
- if(Pcr->PrcbData.FeatureBits & X86_FEATURE_SSE)
- {
- /* Replace the ret by a nop */
- /* FIXME - *(PCHAR)RtlPrefetchMemoryNonTemporal = 0x90; */
- }
-
</pre><pre class="diff" id="context"> /* Does the CPU Support Fast \
System Call? */ if (Pcr->PrcbData.FeatureBits & \
X86_FEATURE_SYSCALL) {
</pre>
</div>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic