From f1cd1b816a238641b15cc6878bc574001a6e3e4e Mon Sep 17 00:00:00 2001 From: Adeel Mujahid Date: Mon, 18 Feb 2019 06:29:23 +0200 Subject: [PATCH] Delete RtlMoveMemory and tests (dotnet/coreclr#22668) Commit migrated from https://github.com/dotnet/coreclr/commit/6252e7d5b428b17e46fc4424bdf6fad38ebd1c35 --- src/coreclr/src/pal/inc/pal.h | 9 --- src/coreclr/src/pal/src/memory/heap.cpp | 23 ------- .../palsuite/filemapping_memmgt/CMakeLists.txt | 2 - .../RtlMoveMemory/CMakeLists.txt | 7 -- .../RtlMoveMemory/test1/CMakeLists.txt | 17 ----- .../RtlMoveMemory/test1/test1.cpp | 56 ---------------- .../RtlMoveMemory/test1/testinfo.dat | 15 ----- .../RtlMoveMemory/test3/CMakeLists.txt | 17 ----- .../RtlMoveMemory/test3/test3.cpp | 72 -------------------- .../RtlMoveMemory/test3/testinfo.dat | 17 ----- .../RtlMoveMemory/test4/CMakeLists.txt | 17 ----- .../RtlMoveMemory/test4/test4.cpp | 76 ---------------------- .../RtlMoveMemory/test4/testinfo.dat | 18 ----- .../RtlMoveMemory/test5/CMakeLists.txt | 17 ----- .../RtlMoveMemory/test5/test5.cpp | 63 ------------------ .../RtlMoveMemory/test5/testinfo.dat | 18 ----- src/coreclr/src/pal/tests/palsuite/paltestlist.txt | 4 -- 17 files changed, 448 deletions(-) delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/test1.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test3/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test3/test3.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test3/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test4/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test4/test4.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test4/testinfo.dat delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/CMakeLists.txt delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/test5.cpp delete mode 100644 src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/testinfo.dat diff --git a/src/coreclr/src/pal/inc/pal.h b/src/coreclr/src/pal/inc/pal.h index 0357464..20befc9 100644 --- a/src/coreclr/src/pal/inc/pal.h +++ b/src/coreclr/src/pal/inc/pal.h @@ -2827,20 +2827,11 @@ VirtualQuery( OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength); -PALIMPORT -VOID -PALAPI -RtlMoveMemory( - IN PVOID Destination, - IN CONST VOID *Source, - IN SIZE_T Length); - #define MoveMemory memmove #define CopyMemory memcpy #define FillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) #define ZeroMemory(Destination,Length) memset((Destination),0,(Length)) - PALIMPORT HANDLE PALAPI diff --git a/src/coreclr/src/pal/src/memory/heap.cpp b/src/coreclr/src/pal/src/memory/heap.cpp index ccee77f..42681bc 100644 --- a/src/coreclr/src/pal/src/memory/heap.cpp +++ b/src/coreclr/src/pal/src/memory/heap.cpp @@ -40,29 +40,6 @@ SET_DEFAULT_DEBUG_CHANNEL(MEM); /*++ Function: - RtlMoveMemory - -See MSDN doc. ---*/ -VOID -PALAPI -RtlMoveMemory( - IN PVOID Destination, - IN CONST VOID *Source, - IN SIZE_T Length) -{ - PERF_ENTRY(RtlMoveMemory); - ENTRY("RtlMoveMemory(Destination:%p, Source:%p, Length:%d)\n", - Destination, Source, Length); - - memmove(Destination, Source, Length); - - LOGEXIT("RtlMoveMemory returning\n"); - PERF_EXIT(RtlMoveMemory); -} - -/*++ -Function: HeapCreate See MSDN doc. diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt index 4f996bd..a0f1eb8 100644 --- a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt +++ b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt @@ -17,10 +17,8 @@ add_subdirectory(MapViewOfFile) add_subdirectory(OpenFileMappingA) add_subdirectory(OpenFileMappingW) add_subdirectory(ProbeMemory) -add_subdirectory(RtlMoveMemory) add_subdirectory(UnmapViewOfFile) add_subdirectory(VirtualAlloc) add_subdirectory(VirtualFree) add_subdirectory(VirtualProtect) add_subdirectory(VirtualQuery) - diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/CMakeLists.txt deleted file mode 100644 index 393074b..0000000 --- a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) -add_subdirectory(test3) -add_subdirectory(test4) -add_subdirectory(test5) - diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/CMakeLists.txt deleted file mode 100644 index 12aba80..0000000 --- a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test1.cpp -) - -add_executable(paltest_rtlmovememory_test1 - ${SOURCES} -) - -add_dependencies(paltest_rtlmovememory_test1 coreclrpal) - -target_link_libraries(paltest_rtlmovememory_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/test1.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/test1.cpp deleted file mode 100644 index 7fc5651..0000000 --- a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test1/test1.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test1.c -** -** Purpose: Simple test -- have two 128 blocks of memory allocated. Then -** move one block to the other and check to see that the data was not -** corrupted. -** -** -**============================================================*/ - -#include - -enum Memory -{ - MEMORY_AMOUNT = 128 -}; - -int __cdecl main(int argc, char *argv[]) -{ - char NewAddress[MEMORY_AMOUNT]; - char OldAddress[MEMORY_AMOUNT]; - int i; - char temp; - - if(PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Put some data into the block we'll be moving */ - memset(OldAddress, 'X', MEMORY_AMOUNT); - - /* Move the block to the NewAddress */ - RtlMoveMemory(NewAddress, OldAddress, MEMORY_AMOUNT); - - /* Check to ensure the data didn't get corrupted */ - for(i=0; i - -enum Memory -{ - NEW_MEMORY_AMOUNT = 128, - OLD_MEMORY_AMOUNT = 10 -}; - -int __cdecl main(int argc, char *argv[]) -{ - char NewAddress[NEW_MEMORY_AMOUNT]; - char OldAddress[OLD_MEMORY_AMOUNT]; - int i; - - - if(PAL_Initialize(argc, argv)) - { - return FAIL; - } - - /* Put some data into the block we'll be moving */ - memset(OldAddress, 'X', OLD_MEMORY_AMOUNT); - - /* Put some data into the block we're moving to */ - memset(NewAddress, 'Z', NEW_MEMORY_AMOUNT); - - /* Move the block to the NewAddress */ - RtlMoveMemory(NewAddress, OldAddress, OLD_MEMORY_AMOUNT); - - /* Check to ensure the moved data didn't get corrupted */ - for(i=0; i i+50 Check to make sure -** no data is lost. -** -** -**============================================================*/ - -#include - -enum Memory -{ - MEMORY_AMOUNT = 128 -}; - -int __cdecl main(int argc, char *argv[]) -{ - char* NewAddress; - char OldAddress[MEMORY_AMOUNT]; - int i; - - if(PAL_Initialize(argc, argv)) - { - return FAIL; - } - - NewAddress = OldAddress+50; - - /* Put some data into the block we'll be moving - The first 50 byes will be 'X' and the rest set to 'Z' - */ - memset(OldAddress, 'X', 50); - memset(NewAddress, 'Z', MEMORY_AMOUNT-50); - - /* Move the first 50 bytes of OldAddress to OldAddress+50. This - is to test that the source and destination addresses can overlap. - */ - RtlMoveMemory(NewAddress, OldAddress, 50); - - /* Check to ensure the moved data didn't get corrupted - The first 50 bytes should be 'X' - */ - for(i=0; i<50; ++i) - { - if(NewAddress[i] != 'X') - { - Fail("ERROR: When the memory was moved to a new location, the " - "data which was stored in it was somehow corrupted. " - "Character %d should have been 'X' but instead is %c.\n", - i, NewAddress[i]); - } - } - - /* The rest of the memory should be 'Z' */ - for(i=50; i i+50 Check to make sure -= no data is lost. - - - - diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/CMakeLists.txt deleted file mode 100644 index f3c38f2..0000000 --- a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test5.cpp -) - -add_executable(paltest_rtlmovememory_test5 - ${SOURCES} -) - -add_dependencies(paltest_rtlmovememory_test5 coreclrpal) - -target_link_libraries(paltest_rtlmovememory_test5 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/test5.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/test5.cpp deleted file mode 100644 index affcb0a..0000000 --- a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/RtlMoveMemory/test5/test5.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================= -** -** Source: test5.c -** -** Purpose: Do more complex overlapping. Move a section of memory back so -** that it actually ends up overlapping itself. -** -** -**============================================================*/ - -#include - -enum Memory -{ - MEMORY_AMOUNT = 128 -}; - -int __cdecl main(int argc, char *argv[]) -{ - char* NewAddress; - char* SectionToMove; - char TheMemory[MEMORY_AMOUNT]; - int i; - - if(PAL_Initialize(argc, argv)) - { - return FAIL; - } - - NewAddress = TheMemory; - SectionToMove = TheMemory+50; - - /* Put some data into the first 50 bytes */ - memset(TheMemory, 'X', 50); - - /* Put some data into the rest of the memory */ - memset(SectionToMove, 'Z', MEMORY_AMOUNT-50); - - /* Move the section in the middle of TheMemory back to the start of - TheMemory -- but have it also overlap itself. (ie. the section - to be move is overlapping itself) - */ - RtlMoveMemory(NewAddress, SectionToMove, MEMORY_AMOUNT-50); - - /* Check to ensure the moved data didn't get corrupted */ - for(i=0; i