KERNEL32: move FlushInstructionCache to ntdll
Mike McCormack
mike at codeweavers.com
Mon Aug 2 23:50:01 CDT 2004
FlushInstructionCache boils down to a no-operation on x86 architectures,
provided there's a call or jump instruction to flush the prefetch queue.
Mike
ChangeLog:
* move FlushInstructionCache to ntdll
-------------- next part --------------
Index: dlls/ntdll/process.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/process.c,v
retrieving revision 1.2
diff -u -r1.2 process.c
--- dlls/ntdll/process.c 14 Jun 2004 17:02:00 -0000 1.2
+++ dlls/ntdll/process.c 3 Aug 2004 03:28:53 -0000
@@ -154,3 +154,20 @@
ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength);
return 0;
}
+
+/******************************************************************************
+ * NtFlushInstructionCache [NTDLL.@]
+ * ZwFlushInstructionCache [NTDLL.@]
+ */
+NTSTATUS WINAPI NtFlushInstructionCache(
+ IN HANDLE ProcessHandle,
+ IN LPCVOID BaseAddress,
+ IN ULONG Size)
+{
+#ifdef __i386__
+ TRACE("%p %p %ld - no-op on x86\n", ProcessHandle, BaseAddress, Size );
+#else
+ FIXME("%p %p %ld\n", ProcessHandle, BaseAddress, Size );
+#endif
+ return STATUS_SUCCESS;
+}
Index: dlls/ntdll/ntdll.spec
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/ntdll.spec,v
retrieving revision 1.158
diff -u -r1.158 ntdll.spec
--- dlls/ntdll/ntdll.spec 30 Jul 2004 01:45:16 -0000 1.158
+++ dlls/ntdll/ntdll.spec 3 Aug 2004 03:28:54 -0000
@@ -115,7 +115,7 @@
@ stdcall NtEnumerateValueKey (long long long long long long)
@ stub NtExtendSection
@ stdcall NtFlushBuffersFile(long ptr)
-@ stub NtFlushInstructionCache
+@ stdcall NtFlushInstructionCache(long ptr long)
@ stdcall NtFlushKey(long)
@ stdcall NtFlushVirtualMemory(long ptr ptr long)
@ stub NtFlushWriteBuffer
@@ -698,7 +698,7 @@
@ stdcall ZwEnumerateValueKey(long long long ptr long ptr) NtEnumerateValueKey
@ stub ZwExtendSection
@ stdcall ZwFlushBuffersFile(long ptr) NtFlushBuffersFile
-@ stub ZwFlushInstructionCache
+@ stdcall ZwFlushInstructionCache(long ptr long) NtFlushInstructionCache
@ stdcall ZwFlushKey(long) NtFlushKey
@ stdcall ZwFlushVirtualMemory(long ptr ptr long) NtFlushVirtualMemory
@ stub ZwFlushWriteBuffer
Index: dlls/kernel/process.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/process.c,v
retrieving revision 1.69
diff -u -r1.69 process.c
--- dlls/kernel/process.c 16 Jul 2004 03:54:35 -0000 1.69
+++ dlls/kernel/process.c 3 Aug 2004 03:28:54 -0000
@@ -2740,9 +2740,11 @@
*/
BOOL WINAPI FlushInstructionCache(HANDLE hProcess, LPCVOID lpBaseAddress, SIZE_T dwSize)
{
+ NTSTATUS status;
if (GetVersion() & 0x80000000) return TRUE; /* not NT, always TRUE */
- FIXME("(%p,%p,0x%08lx): stub\n",hProcess, lpBaseAddress, dwSize);
- return TRUE;
+ status = NtFlushInstructionCache( hProcess, lpBaseAddress, dwSize );
+ if (status) SetLastError( RtlNtStatusToDosError(status) );
+ return !status;
}
Index: include/winternl.h
===================================================================
RCS file: /home/wine/wine/include/winternl.h,v
retrieving revision 1.84
diff -u -r1.84 winternl.h
--- include/winternl.h 30 Jul 2004 01:45:16 -0000 1.84
+++ include/winternl.h 3 Aug 2004 03:28:54 -0000
@@ -1242,6 +1242,7 @@
NTSTATUS WINAPI NtEnumerateKey(HKEY,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *);
NTSTATUS WINAPI NtEnumerateValueKey(HKEY,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSTATUS WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*);
+NTSTATUS WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,ULONG);
NTSTATUS WINAPI NtFlushKey(HKEY);
NTSTATUS WINAPI NtFlushVirtualMemory(HANDLE,LPCVOID*,ULONG*,ULONG);
NTSTATUS WINAPI NtFreeVirtualMemory(HANDLE,PVOID*,ULONG*,ULONG);
More information about the wine-patches
mailing list