ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2011
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
24 participants
517 discussions
Start a n
N
ew thread
[akhaldi] 52873: [CMAKE] * Update our asm support thanks to Jerome. * Bring in CMakeDetermineCompilerId.cmake to make sure this will work for pretty much all systems. * Disable the use of response ...
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Jul 25 20:50:05 2011 New Revision: 52873 URL:
http://svn.reactos.org/svn/reactos?rev=52873&view=rev
Log: [CMAKE] * Update our asm support thanks to Jerome. * Bring in CMakeDetermineCompilerId.cmake to make sure this will work for pretty much all systems. * Disable the use of response files when you enable ccache. Added: trunk/reactos/cmake/CMakeDetermineCompilerId.cmake Modified: trunk/reactos/CMakeLists.txt trunk/reactos/cmake/CMakeDetermineASMCompiler.cmake Modified: trunk/reactos/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=52873&r…
============================================================================== --- trunk/reactos/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/CMakeLists.txt [iso-8859-1] Mon Jul 25 20:50:05 2011 @@ -77,6 +77,11 @@ #useful stuff! include(CMakeParseArguments) + + if(ENABLE_CCACHE) + set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES OFF) + set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES OFF) + endif() # Do some cleanup file(REMOVE Modified: trunk/reactos/cmake/CMakeDetermineASMCompiler.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/CMakeDetermineASMCom…
============================================================================== --- trunk/reactos/cmake/CMakeDetermineASMCompiler.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/CMakeDetermineASMCompiler.cmake [iso-8859-1] Mon Jul 25 20:50:05 2011 @@ -1,3 +1,4 @@ + #============================================================================= # Copyright 2007-2009 Kitware, Inc. # @@ -20,11 +21,37 @@ ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+") # finally list compilers to try - IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT}) - ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}as ${_CMAKE_TOOLCHAIN_PREFIX}gas) - ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support + + IF(CMAKE_ASM_COMPILER_INIT) + SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT}) + ELSE(CMAKE_ASM_COMPILER_INIT) + + IF(CMAKE_C_COMPILER) + SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler") + SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}") + ELSEIF(CMAKE_CXX_COMPILER) + SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler") + SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") + ELSE(CMAKE_CXX_COMPILER) + # List all default C and CXX compilers + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc + ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC) + ENDIF(CMAKE_C_COMPILER) + + ENDIF(CMAKE_ASM_COMPILER_INIT) + + + ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect" + + IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT}) + ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !") + ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + + ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM") + # Find the compiler. IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH) @@ -62,21 +89,43 @@ # Table of per-vendor compiler id flags with expected output. LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU ) SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") - SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "GNU assembler") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C") + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP ) SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h") SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS VISUAL) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_VISUAL "/?") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_VISUAL "Microsoft Corporation") INCLUDE(CMakeDetermineCompilerId) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) - IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") - ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) - MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") - ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) +ENDIF() -ENDIF() +IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") +ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") +ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + # If we have a gas/as cross compiler, they have usually some prefix, like @@ -89,9 +138,24 @@ IF (NOT _CMAKE_TOOLCHAIN_PREFIX) GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME) IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") - STRING(REGEX REPLACE "^(.+-)g?as(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) + +# Now try the C compiler regexp: +IF (NOT _CMAKE_TOOLCHAIN_PREFIX) + IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") +ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) + +# Finally try the CXX compiler regexp: +IF (NOT _CMAKE_TOOLCHAIN_PREFIX) + IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") +ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) + INCLUDE(CMakeFindBinUtils) @@ -105,6 +169,7 @@ SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}") +SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}") SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}") Added: trunk/reactos/cmake/CMakeDetermineCompilerId.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/CMakeDetermineCompil…
============================================================================== --- trunk/reactos/cmake/CMakeDetermineCompilerId.cmake (added) +++ trunk/reactos/cmake/CMakeDetermineCompilerId.cmake [iso-8859-1] Mon Jul 25 20:50:05 2011 @@ -1,0 +1,315 @@ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Function to compile a source file to identify the compiler. This is +# used internally by CMake and should not be included by user code. +# If successful, sets CMAKE_<lang>_COMPILER_ID and CMAKE_<lang>_PLATFORM_ID + +FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) + # Make sure the compiler arguments are clean. + STRING(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1) + STRING(REGEX REPLACE " +" ";" CMAKE_${lang}_COMPILER_ID_ARG1 "${CMAKE_${lang}_COMPILER_ID_ARG1}") + + # Make sure user-specified compiler flags are used. + IF(CMAKE_${lang}_FLAGS) + SET(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS}) + ELSE(CMAKE_${lang}_FLAGS) + SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}}) + ENDIF(CMAKE_${lang}_FLAGS) + STRING(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") + + # Compute the directory in which to run the test. + SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) + + # Try building with no extra flags and then try each set + # of helper flags. Stop when the compiler is identified. + FOREACH(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) + IF(NOT CMAKE_${lang}_COMPILER_ID) + CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") + FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES}) + CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") + ENDFOREACH(file) + ENDIF(NOT CMAKE_${lang}_COMPILER_ID) + ENDFOREACH(flags) + + # If the compiler is still unknown, try to query its vendor. + IF(NOT CMAKE_${lang}_COMPILER_ID) + CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang}) + ENDIF() + + # if the format is unknown after all files have been checked, put "Unknown" in the cache + IF(NOT CMAKE_EXECUTABLE_FORMAT) + SET(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") + ENDIF(NOT CMAKE_EXECUTABLE_FORMAT) + + # Display the final identification result. + IF(CMAKE_${lang}_COMPILER_ID) + MESSAGE(STATUS "The ${lang} compiler identification is " + "${CMAKE_${lang}_COMPILER_ID}") + ELSE(CMAKE_${lang}_COMPILER_ID) + MESSAGE(STATUS "The ${lang} compiler identification is unknown") + ENDIF(CMAKE_${lang}_COMPILER_ID) + + SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) + SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) + SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + PARENT_SCOPE) +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID) + +#----------------------------------------------------------------------------- +# Function to write the compiler id source file. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src) + FILE(READ ${CMAKE_ROOT}/Modules/${src}.in ID_CONTENT_IN) + STRING(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY) + FILE(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}") +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE) + +#----------------------------------------------------------------------------- +# Function to build the compiler id source file and look for output +# files. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src) + # Create a clean working directory. + FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) + FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) + CMAKE_DETERMINE_COMPILER_ID_WRITE("${lang}" "${src}") + + # Construct a description of this test case. + SET(COMPILER_DESCRIPTION + "Compiler: ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1} +Build flags: ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} +Id flags: ${testflags} +") + + # Compile the compiler identification source. + IF(COMMAND EXECUTE_PROCESS) + EXECUTE_PROCESS( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + "${src}" + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) + ELSE(COMMAND EXECUTE_PROCESS) + EXEC_PROGRAM( + ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR} + ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + \"${src}\" + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT + ) + ENDIF(COMMAND EXECUTE_PROCESS) + + # Check the result of compilation. + IF(CMAKE_${lang}_COMPILER_ID_RESULT) + # Compilation failed. + SET(MSG + "Compiling the ${lang} compiler identification source file \"${src}\" failed. +${COMPILER_DESCRIPTION} +The output was: +${CMAKE_${lang}_COMPILER_ID_RESULT} +${CMAKE_${lang}_COMPILER_ID_OUTPUT} + +") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}") + #IF(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL) + # MESSAGE(FATAL_ERROR "${MSG}") + #ENDIF(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL) + + # No output files should be inspected. + SET(COMPILER_${lang}_PRODUCED_FILES) + ELSE(CMAKE_${lang}_COMPILER_ID_RESULT) + # Compilation succeeded. + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Compiling the ${lang} compiler identification source file \"${src}\" succeeded. +${COMPILER_DESCRIPTION} +The output was: +${CMAKE_${lang}_COMPILER_ID_RESULT} +${CMAKE_${lang}_COMPILER_ID_OUTPUT} + +") + + # Find the executable produced by the compiler, try all files in the + # binary dir. + FILE(GLOB COMPILER_${lang}_PRODUCED_FILES + RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR} + ${CMAKE_${lang}_COMPILER_ID_DIR}/*) + LIST(REMOVE_ITEM COMPILER_${lang}_PRODUCED_FILES "${src}") + FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES}) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Compilation of the ${lang} compiler identification source \"" + "${src}\" produced \"${file}\"\n\n") + ENDFOREACH(file) + + IF(NOT COMPILER_${lang}_PRODUCED_FILES) + # No executable was found. + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Compilation of the ${lang} compiler identification source \"" + "${src}\" did not produce an executable in \"" + "${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n") + ENDIF(NOT COMPILER_${lang}_PRODUCED_FILES) + ENDIF(CMAKE_${lang}_COMPILER_ID_RESULT) + + # Return the files produced by the compilation. + SET(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE) +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src) + +#----------------------------------------------------------------------------- +# Function to extract the compiler id from an executable. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) + # Look for a compiler id if not yet known. + IF(NOT CMAKE_${lang}_COMPILER_ID) + # Read the compiler identification string from the executable file. + SET(COMPILER_ID) + SET(PLATFORM_ID) + FILE(STRINGS ${file} + CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 3 REGEX "INFO:") + SET(HAVE_COMPILER_TWICE 0) + FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) + IF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") + IF(COMPILER_ID) + SET(COMPILER_ID_TWICE 1) + ENDIF(COMPILER_ID) + STRING(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1" + COMPILER_ID "${info}") + ENDIF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") + IF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") + STRING(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1" + PLATFORM_ID "${info}") + ENDIF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") + IF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") + STRING(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1" + ARCHITECTURE_ID "${info}") + ENDIF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") + ENDFOREACH(info) + + # Check if a valid compiler and platform were found. + IF(COMPILER_ID AND NOT COMPILER_ID_TWICE) + SET(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}") + SET(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}") + SET(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}") + ENDIF(COMPILER_ID AND NOT COMPILER_ID_TWICE) + + # Check the compiler identification string. + IF(CMAKE_${lang}_COMPILER_ID) + # The compiler identification was found. + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "The ${lang} compiler identification is ${CMAKE_${lang}_COMPILER_ID}, found in \"" + "${file}\"\n\n") + ELSE(CMAKE_${lang}_COMPILER_ID) + # The compiler identification could not be found. + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "The ${lang} compiler identification could not be found in \"" + "${file}\"\n\n") + ENDIF(CMAKE_${lang}_COMPILER_ID) + ENDIF(NOT CMAKE_${lang}_COMPILER_ID) + + # try to figure out the executable format: ELF, COFF, Mach-O + IF(NOT CMAKE_EXECUTABLE_FORMAT) + FILE(READ ${file} CMAKE_EXECUTABLE_MAGIC LIMIT 4 HEX) + + # ELF files start with 0x7f"ELF" + IF("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46") + SET(CMAKE_EXECUTABLE_FORMAT "ELF" CACHE INTERNAL "Executable file format") + ENDIF("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46") + +# # COFF (.exe) files start with "MZ" +# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....") +# SET(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format") +# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....") +# +# # Mach-O files start with CAFEBABE or FEEDFACE, according to
http://radio.weblogs.com/0100490/2003/01/28.html
+# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe") +# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") +# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe") +# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface") +# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") +# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface") + + ENDIF(NOT CMAKE_EXECUTABLE_FORMAT) + IF(NOT DEFINED CMAKE_EXECUTABLE_FORMAT) + SET(CMAKE_EXECUTABLE_FORMAT) + ENDIF() + # Return the information extracted. + SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) + SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) + SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + PARENT_SCOPE) + SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang) + +#----------------------------------------------------------------------------- +# Function to query the compiler vendor. +# This uses a table with entries of the form +# list(APPEND CMAKE_${lang}_COMPILER_ID_VENDORS ${vendor}) +# set(CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor} -some-vendor-flag) +# set(CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor} "Some Vendor Output") +# We try running the compiler with the flag for each vendor and +# matching its regular expression in the output. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) + + IF(NOT CMAKE_${lang}_COMPILER_ID_DIR) + # We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID() + # This is done e.g. for detecting the compiler ID for assemblers. + # Compute the directory in which to run the test and Create a clean working directory. + SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) + FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) + FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) + ENDIF(NOT CMAKE_${lang}_COMPILER_ID_DIR) + + + FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS}) + SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}}) + SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}}) + EXECUTE_PROCESS( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${flags} + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE output ERROR_VARIABLE output + RESULT_VARIABLE result + TIMEOUT 10 + ) + + IF("${lang}" STREQUAL "ASM") + MESSAGE(STATUS "Checked for ${vendor}") + MESSAGE(STATUS " Output: -${output}-") + MESSAGE(STATUS " Result: -${result}-") + ENDIF("${lang}" STREQUAL "ASM") + + IF("${output}" MATCHES "${regex}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "matched \"${regex}\":\n${output}") + SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE) + BREAK() + ELSE() + IF("${result}" MATCHES "timeout") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "terminated after 10 s due to timeout.") + ELSE() + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "did not match \"${regex}\":\n${output}") + ENDIF() + ENDIF() + ENDFOREACH() +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR)
13 years, 5 months
1
0
0
0
[ion] 52872: [KERNEL32]: Now that we have the BaseStaticServerData initialized, don't build the \ReactOS and \ReactOS\System32 paths by hand: use the ones we have. [KERNEL32]: Same goes for BaseCac...
by ion@svn.reactos.org
Author: ion Date: Mon Jul 25 20:23:43 2011 New Revision: 52872 URL:
http://svn.reactos.org/svn/reactos?rev=52872&view=rev
Log: [KERNEL32]: Now that we have the BaseStaticServerData initialized, don't build the \ReactOS and \ReactOS\System32 paths by hand: use the ones we have. [KERNEL32]: Same goes for BaseCachedSysInfo. Use the BaseStaticServerData->SysInfo instead now. [KERNEL32]: Don't assume that the BNO directory is called BaseNamedObjects (this won't be true once GedMurphy's dream of multi-session support comes true) -- instead, use the one from BaseStaticServerData. Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c trunk/reactos/dll/win32/kernel32/client/except.c trunk/reactos/dll/win32/kernel32/client/heapmem.c Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] Mon Jul 25 20:23:43 2011 @@ -29,6 +29,7 @@ WCHAR BaseDefaultPathBuffer[6140]; +HANDLE BaseNamedObjectDirectory; HANDLE hProcessHeap = NULL; HMODULE hCurrentModule = NULL; HMODULE kernel32_handle = NULL; @@ -36,7 +37,7 @@ PPEB Peb; ULONG SessionId; BOOL ConsoleInitialized = FALSE; - +UNICODE_STRING BaseWindowsDirectory, BaseWindowsSystemDirectory; static BOOL DllInitialized = FALSE; BOOL WINAPI @@ -68,34 +69,28 @@ #define WIN_OBJ_DIR L"\\Windows" #define SESSION_DIR L"\\Sessions" -SYSTEM_BASIC_INFORMATION BaseCachedSysInfo; - /* FUNCTIONS *****************************************************************/ NTSTATUS WINAPI -OpenBaseDirectory(PHANDLE DirHandle) +BaseGetNamedObjectDirectory(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING Name = RTL_CONSTANT_STRING(L"\\BaseNamedObjects"); NTSTATUS Status; InitializeObjectAttributes(&ObjectAttributes, - &Name, + &BaseStaticServerData->NamedObjectDirectory, OBJ_CASE_INSENSITIVE, NULL, NULL); - Status = NtOpenDirectoryObject(DirHandle, + Status = NtOpenDirectoryObject(&BaseNamedObjectDirectory, DIRECTORY_ALL_ACCESS & ~(DELETE | WRITE_DAC | WRITE_OWNER), &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - DPRINT("Opened BNO: %lx\n", *DirHandle); + if (!NT_SUCCESS(Status)) return Status; + + DPRINT("Opened BNO: %lx\n", BaseNamedObjectDirectory); return Status; } @@ -144,8 +139,8 @@ WCHAR lpTest[MAX_PATH]; GetModuleFileNameW(NULL, lpTest, MAX_PATH); DPRINT("BasepInitConsole for : %S\n", lpTest); - DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n", - Parameters->ConsoleHandle, Parameters->StandardInput, + DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n", + Parameters->ConsoleHandle, Parameters->StandardInput, Parameters->StandardOutput, Parameters->StandardError); /* We have nothing to do if this isn't a console app... */ @@ -204,7 +199,7 @@ ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\'); if (ExeName) SetConsoleInputExeNameW(ExeName + 1); - + /* Now use the proper console handle */ Request.Data.AllocConsoleRequest.Console = Parameters->ConsoleHandle; @@ -216,7 +211,7 @@ */ CsrRequest = MAKE_CSR_API(ALLOC_CONSOLE, CSR_CONSOLE); Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher; - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); @@ -226,7 +221,7 @@ /* We're lying here, so at least the process can load... */ return TRUE; } - + if (NotConsole) return TRUE; /* We got the handles, let's set them */ @@ -247,7 +242,7 @@ } } - DPRINT("Console setup: %lx, %lx, %lx, %lx\n", + DPRINT("Console setup: %lx, %lx, %lx, %lx\n", Parameters->ConsoleHandle, Parameters->StandardInput, Parameters->StandardOutput, @@ -274,7 +269,7 @@ }, {0} }; - + /* Allocate the fake data */ BaseStaticServerData = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, @@ -305,13 +300,13 @@ Status = RtlCreateUnicodeString(&BaseStaticServerData->NamedObjectDirectory, L"\\BaseNamedObjects"); ASSERT(NT_SUCCESS(Status)); - } + } else { /* Hopefully we'll fix CSRSS Before we add multiple sessions... */ ASSERT(FALSE); } - + /* * Confirmed that in Windows, CSDNumber and RCNumber are actually Length * and MaximumLength of the CSD String, since the same UNICODE_STRING is @@ -319,10 +314,10 @@ * * Somehow, in Windows this doesn't cause a buffer overflow, but it might * in ReactOS, so this code is disabled until someone figures out WTF. - */ + */ BaseStaticServerData->CSDNumber = 0; BaseStaticServerData->RCNumber = 0; - + /* Initialize the CSD string */ RtlInitEmptyUnicodeString(&BaseSrvCSDString, Buffer, sizeof(Buffer)); @@ -333,7 +328,6 @@ NULL); if (NT_SUCCESS(Status)) { - DPRINT1("CSD String: %wZ\n", &BaseSrvCSDString); wcsncpy(BaseStaticServerData->CSDVersion, BaseSrvCSDString.Buffer, BaseSrvCSDString.Length / sizeof(WCHAR)); @@ -348,7 +342,7 @@ sizeof(BaseStaticServerData->SysInfo), NULL); ASSERT(NT_SUCCESS(Status)); - + BaseStaticServerData->DefaultSeparateVDM = FALSE; BaseStaticServerData->IsWowTaskReady = FALSE; BaseStaticServerData->LUIDDeviceMapsEnabled = FALSE; @@ -360,14 +354,6 @@ sizeof(BaseStaticServerData->TimeOfDay), NULL); ASSERT(NT_SUCCESS(Status)); - - DPRINT1("ReactOS Base API Connected: %wZ %wZ %wZ %S %d KB\n", - &BaseStaticServerData->WindowsDirectory, - &BaseStaticServerData->WindowsSystemDirectory, - &BaseStaticServerData->NamedObjectDirectory, - BaseStaticServerData->CSDVersion, - BaseStaticServerData->SysInfo.PageSize * - BaseStaticServerData->SysInfo.NumberOfPhysicalPages / 1024); } BOOL @@ -429,26 +415,24 @@ ZwTerminateProcess(NtCurrentProcess(), Status); return FALSE; } - + /* Get the server data */ - DPRINT1("Server data: %p\n", Peb->ReadOnlyStaticServerData); if (!Peb->ReadOnlyStaticServerData) { /* Build fake one for ReactOS */ BasepFakeStaticServerData(); - + /* Allocate the array */ Peb->ReadOnlyStaticServerData = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, 4 * sizeof(PVOID)); - + /* Set the data for the BASESRV DLL Index */ Peb->ReadOnlyStaticServerData[CSR_CONSOLE] = BaseStaticServerData; } - + /* Get the server data */ BaseStaticServerData = Peb->ReadOnlyStaticServerData[CSR_CONSOLE]; - DPRINT1("Static data: %p\n", BaseStaticServerData); ASSERT(BaseStaticServerData); /* Check if we are running a CSR Server */ @@ -459,30 +443,21 @@ CsrNewThread(); } + /* Initialize heap handle table */ hProcessHeap = RtlGetProcessHeap(); RtlInitializeHandleTable(0xFFFF, sizeof(BASE_HEAP_HANDLE_ENTRY), &BaseHeapHandleTable); + DPRINT("Heap: %p\n", hProcessHeap); + + /* Set HMODULE for our DLL */ kernel32_handle = hCurrentModule = hDll; - DPRINT("Heap: %p\n", hProcessHeap); - - /* - * Initialize WindowsDirectory and SystemDirectory - */ - DPRINT("NtSystemRoot: %S\n", SharedUserData->NtSystemRoot); - RtlCreateUnicodeString (&WindowsDirectory, SharedUserData->NtSystemRoot); - SystemDirectory.MaximumLength = WindowsDirectory.MaximumLength + 18; - SystemDirectory.Length = WindowsDirectory.Length + 18; - SystemDirectory.Buffer = RtlAllocateHeap(hProcessHeap, - 0, - SystemDirectory.MaximumLength); - if(SystemDirectory.Buffer == NULL) - { - DPRINT1("Failure allocating SystemDirectory buffer\n"); - return FALSE; - } - wcscpy(SystemDirectory.Buffer, WindowsDirectory.Buffer); - wcscat(SystemDirectory.Buffer, L"\\System32"); + + /* Set the directories */ + BaseWindowsDirectory = BaseStaticServerData->WindowsDirectory; + BaseWindowsSystemDirectory = BaseStaticServerData->WindowsSystemDirectory; + SystemDirectory = BaseWindowsSystemDirectory; + WindowsDirectory = BaseWindowsDirectory; /* Construct the default path (using the static buffer) */ _snwprintf(BaseDefaultPathBuffer, sizeof(BaseDefaultPathBuffer) / sizeof(WCHAR), @@ -501,7 +476,8 @@ InitCommandLines(); /* Open object base directory */ - Status = OpenBaseDirectory(&hBaseDir); + Status = BaseGetNamedObjectDirectory(); + hBaseDir = BaseNamedObjectDirectory; if (!NT_SUCCESS(Status)) { DPRINT1("Failed to open object base directory (Status %lx)\n", Status); @@ -522,17 +498,6 @@ if (!BasepInitConsole()) { DPRINT1("Failure to set up console\n"); - return FALSE; - } - - /* Cache static system information */ - Status = ZwQuerySystemInformation(SystemBasicInformation, - &BaseCachedSysInfo, - sizeof(BaseCachedSysInfo), - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failure to get system information\n"); return FALSE; } @@ -559,9 +524,6 @@ /* Close object base directory */ NtClose(hBaseDir); - - RtlFreeUnicodeString (&SystemDirectory); - RtlFreeUnicodeString (&WindowsDirectory); } break; Modified: trunk/reactos/dll/win32/kernel32/client/except.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/except.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/except.c [iso-8859-1] Mon Jul 25 20:23:43 2011 @@ -454,7 +454,7 @@ if (!lp) return TRUE; /* Get the page size */ - PageSize = BaseCachedSysInfo.PageSize; + PageSize = BaseStaticServerData->SysInfo.PageSize; /* Calculate the last page */ Last = (PCHAR)((ULONG_PTR)lp + ucb - 1); @@ -526,7 +526,7 @@ if (!lp) return TRUE; /* Get the page size */ - PageSize = BaseCachedSysInfo.PageSize; + PageSize = BaseStaticServerData->SysInfo.PageSize; /* Calculate the last page */ Last = (PCHAR)((ULONG_PTR)lp + ucb - 1); Modified: trunk/reactos/dll/win32/kernel32/client/heapmem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/heapmem.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/heapmem.c [iso-8859-1] Mon Jul 25 20:23:43 2011 @@ -38,7 +38,7 @@ /* Check if heap is growable and ensure max size is correct */ if (dwMaximumSize == 0) Flags |= HEAP_GROWABLE; - else if (dwMaximumSize < BaseCachedSysInfo.PageSize && + else if (dwMaximumSize < BaseStaticServerData->SysInfo.PageSize && dwInitialSize > dwMaximumSize) { /* Max size is non-zero but less than page size which can't be correct. @@ -1204,18 +1204,18 @@ NULL); /* Calculate memory load */ - lpBuffer->dwMemoryLoad = ((DWORD)(BaseCachedSysInfo.NumberOfPhysicalPages - + lpBuffer->dwMemoryLoad = ((DWORD)(BaseStaticServerData->SysInfo.NumberOfPhysicalPages - PerformanceInfo.AvailablePages) * 100) / - BaseCachedSysInfo.NumberOfPhysicalPages; + BaseStaticServerData->SysInfo.NumberOfPhysicalPages; /* Save physical memory */ - PhysicalMemory = BaseCachedSysInfo.NumberOfPhysicalPages * - BaseCachedSysInfo.PageSize; + PhysicalMemory = BaseStaticServerData->SysInfo.NumberOfPhysicalPages * + BaseStaticServerData->SysInfo.PageSize; lpBuffer->ullTotalPhys = PhysicalMemory; /* Now save available physical memory */ PhysicalMemory = PerformanceInfo.AvailablePages * - BaseCachedSysInfo.PageSize; + BaseStaticServerData->SysInfo.PageSize; lpBuffer->ullAvailPhys = PhysicalMemory; /* Query VM and Quota Limits */ @@ -1241,11 +1241,11 @@ lpBuffer->ullAvailPageFile = min(PageFile, QuotaLimits.PagefileLimit - VmCounters.PagefileUsage); - lpBuffer->ullAvailPageFile *= BaseCachedSysInfo.PageSize; + lpBuffer->ullAvailPageFile *= BaseStaticServerData->SysInfo.PageSize; /* Now calculate the total virtual space */ - lpBuffer->ullTotalVirtual = (BaseCachedSysInfo.MaximumUserModeAddress - - BaseCachedSysInfo.MinimumUserModeAddress) + 1; + lpBuffer->ullTotalVirtual = (BaseStaticServerData->SysInfo.MaximumUserModeAddress - + BaseStaticServerData->SysInfo.MinimumUserModeAddress) + 1; /* And finally the avilable virtual space */ lpBuffer->ullAvailVirtual = lpBuffer->ullTotalVirtual -
13 years, 5 months
1
0
0
0
[ion] 52871: [NTDLL]: Export RtlAcquire/ReleasePrivilege.
by ion@svn.reactos.org
Author: ion Date: Mon Jul 25 20:21:51 2011 New Revision: 52871 URL:
http://svn.reactos.org/svn/reactos?rev=52871&view=rev
Log: [NTDLL]: Export RtlAcquire/ReleasePrivilege. Modified: trunk/reactos/dll/ntdll/def/ntdll.pspec trunk/reactos/dll/ntdll/def/ntdll.spec Modified: trunk/reactos/dll/ntdll/def/ntdll.pspec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.pspec?…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.pspec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.pspec [iso-8859-1] Mon Jul 25 20:21:51 2011 @@ -413,6 +413,7 @@ //@ stdcall RtlAbortRXact @ stdcall RtlAbsoluteToSelfRelativeSD(ptr ptr ptr) @ stdcall RtlAcquirePebLock() +@ stdcall RtlAcquirePrivilege(ptr long long ptr) @ stdcall RtlAcquireResourceExclusive(ptr long) @ stdcall RtlAcquireResourceShared(ptr long) @ stdcall RtlAcquireSRWLockExclusive(ptr) @@ -847,6 +848,7 @@ @ stdcall RtlReleaseActivationContext(ptr) //@ stdcall RtlReleaseMemoryStream @ stdcall RtlReleasePebLock() +@ stdcall RtlReleasePrivilege(ptr) @ stdcall RtlReleaseResource(ptr) @ stdcall RtlReleaseSRWLockExclusive(ptr) @ stdcall RtlReleaseSRWLockShared(ptr) Modified: trunk/reactos/dll/ntdll/def/ntdll.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Mon Jul 25 20:21:51 2011 @@ -411,6 +411,7 @@ ;@ stdcall RtlAbortRXact @ stdcall RtlAbsoluteToSelfRelativeSD(ptr ptr ptr) @ stdcall RtlAcquirePebLock() +@ stdcall RtlAdjustPrivilege(long long long ptr) @ stdcall RtlAcquireResourceExclusive(ptr long) @ stdcall RtlAcquireResourceShared(ptr long) @ stdcall RtlAcquireSRWLockExclusive(ptr) @@ -846,6 +847,7 @@ @ stdcall RtlReleaseActivationContext(ptr) ;@ stdcall RtlReleaseMemoryStream @ stdcall RtlReleasePebLock() +@ stdcall RtlReleasePrivilege(ptr) @ stdcall RtlReleaseResource(ptr) @ stdcall RtlReleaseSRWLockExclusive(ptr) @ stdcall RtlReleaseSRWLockShared(ptr)
13 years, 5 months
1
0
0
0
[tfaber] 52870: [KMTESTS/EX] - add quick'n'dirty tests for interlocked single/double list functions
by tfaber@svn.reactos.org
Author: tfaber Date: Mon Jul 25 20:12:44 2011 New Revision: 52870 URL:
http://svn.reactos.org/svn/reactos?rev=52870&view=rev
Log: [KMTESTS/EX] - add quick'n'dirty tests for interlocked single/double list functions Added: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c (with props) branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExSingleList.c (with props) Modified: branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c Modified: branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/C…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt [iso-8859-1] Mon Jul 25 20:12:44 2011 @@ -15,10 +15,12 @@ example/Example.c example/KernelType.c + ntos_ex/ExDoubleList.c ntos_ex/ExHardError.c ntos_ex/ExInterlocked.c ntos_ex/ExPools.c ntos_ex/ExResource.c + ntos_ex/ExSingleList.c ntos_ex/ExTimer.c ntos_fsrtl/FsRtlExpression.c ntos_io/IoDeviceInterface.c Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild [iso-8859-1] Mon Jul 25 20:12:44 2011 @@ -15,10 +15,12 @@ <file>KernelType.c</file> </directory> <directory name="ntos_ex"> + <file>ExDoubleList.c</file> <file>ExHardError.c</file> <file>ExInterlocked.c</file> <file>ExPools.c</file> <file>ExResource.c</file> + <file>ExSingleList.c</file> <file>ExTimer.c</file> </directory> <directory name="ntos_fsrtl"> Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c [iso-8859-1] Mon Jul 25 20:12:44 2011 @@ -9,11 +9,13 @@ #include <kmt_test.h> KMT_TESTFUNC Test_Example; +KMT_TESTFUNC Test_ExDoubleList; KMT_TESTFUNC Test_ExHardError; KMT_TESTFUNC Test_ExHardErrorInteractive; KMT_TESTFUNC Test_ExInterlocked; KMT_TESTFUNC Test_ExPools; KMT_TESTFUNC Test_ExResource; +KMT_TESTFUNC Test_ExSingleList; KMT_TESTFUNC Test_ExTimer; KMT_TESTFUNC Test_FsRtlExpression; KMT_TESTFUNC Test_IoDeviceInterface; @@ -28,11 +30,13 @@ const KMT_TEST TestList[] = { + { "ExDoubleList", Test_ExDoubleList }, { "ExHardError", Test_ExHardError }, { "-ExHardErrorInteractive", Test_ExHardErrorInteractive }, { "ExInterlocked", Test_ExInterlocked }, { "ExPools", Test_ExPools }, { "ExResource", Test_ExResource }, + { "ExSingleList", Test_ExSingleList }, { "ExTimer", Test_ExTimer }, { "Example", Test_Example }, { "FsRtlExpression", Test_FsRtlExpression }, Added: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c [iso-8859-1] Mon Jul 25 20:12:44 2011 @@ -1,0 +1,210 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite Doubly-linked list test + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +struct _LIST_ENTRY; +struct _LIST_ENTRY *__stdcall ExInterlockedInsertHeadList(struct _LIST_ENTRY *, struct _LIST_ENTRY *, unsigned long *); +struct _LIST_ENTRY *__stdcall ExInterlockedInsertTailList(struct _LIST_ENTRY *, struct _LIST_ENTRY *, unsigned long *); +struct _LIST_ENTRY *__stdcall ExInterlockedRemoveHeadList(struct _LIST_ENTRY *, unsigned long *); + +#include <ntddk.h> +#include <kmt_test.h> + +LIST_ENTRY Entries[5]; + +#define ok_eq_free(Value, Expected) do \ +{ \ + if (KmtIsCheckedBuild) \ + ok_eq_pointer(Value, (PVOID)0x0BADD0FF); \ + else \ + ok_eq_pointer(Value, Expected); \ +} while (0) + +#define ok_eq_free2(Value, Expected) do \ +{ \ + if (KmtIsCheckedBuild) \ + ok_eq_pointer(Value, (PVOID)0xBADDD0FF); \ + else \ + ok_eq_pointer(Value, Expected); \ +} while (0) + +START_TEST(ExDoubleList) +{ + KSPIN_LOCK SpinLock; + LIST_ENTRY ListHead; + PLIST_ENTRY Ret; + + KeInitializeSpinLock(&SpinLock); + + memset(&ListHead, 0x55, sizeof ListHead); + InitializeListHead(&ListHead); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedInsertHeadList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &Entries[0]); + ok_eq_pointer(ListHead.Blink, &Entries[0]); + ok_eq_pointer(Entries[0].Flink, &ListHead); + ok_eq_pointer(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_eq_free(Entries[0].Flink, &ListHead); + ok_eq_free(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_eq_free(Entries[0].Flink, &ListHead); + ok_eq_free(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &Entries[0]); + ok_eq_pointer(ListHead.Blink, &Entries[0]); + ok_eq_pointer(Entries[0].Flink, &ListHead); + ok_eq_pointer(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_eq_free(Entries[0].Flink, &ListHead); + ok_eq_free(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_eq_free(Entries[0].Flink, &ListHead); + ok_eq_free(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &Entries[0]); + ok_eq_pointer(ListHead.Blink, &Entries[0]); + ok_eq_pointer(Entries[0].Flink, &ListHead); + ok_eq_pointer(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedInsertHeadList(&ListHead, &Entries[1], &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Flink, &Entries[1]); + ok_eq_pointer(ListHead.Blink, &Entries[0]); + ok_eq_pointer(Entries[0].Flink, &ListHead); + ok_eq_pointer(Entries[0].Blink, &Entries[1]); + ok_eq_pointer(Entries[1].Flink, &Entries[0]); + ok_eq_pointer(Entries[1].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + memset(Entries, 0x55, sizeof Entries); +#undef ExInterlockedInsertHeadList +#undef ExInterlockedInsertTailList +#undef ExInterlockedRemoveHeadList + + memset(&ListHead, 0x55, sizeof ListHead); + InitializeListHead(&ListHead); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedInsertHeadList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &Entries[0]); + ok_eq_pointer(ListHead.Blink, &Entries[0]); + ok_eq_pointer(Entries[0].Flink, &ListHead); + ok_eq_pointer(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_eq_free2(Entries[0].Flink, &ListHead); + ok_eq_free2(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_eq_free2(Entries[0].Flink, &ListHead); + ok_eq_free2(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &Entries[0]); + ok_eq_pointer(ListHead.Blink, &Entries[0]); + ok_eq_pointer(Entries[0].Flink, &ListHead); + ok_eq_pointer(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_eq_free2(Entries[0].Flink, &ListHead); + ok_eq_free2(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &ListHead); + ok_eq_pointer(ListHead.Blink, &ListHead); + ok_eq_free2(Entries[0].Flink, &ListHead); + ok_eq_free2(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Flink, &Entries[0]); + ok_eq_pointer(ListHead.Blink, &Entries[0]); + ok_eq_pointer(Entries[0].Flink, &ListHead); + ok_eq_pointer(Entries[0].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedInsertHeadList(&ListHead, &Entries[1], &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Flink, &Entries[1]); + ok_eq_pointer(ListHead.Blink, &Entries[0]); + ok_eq_pointer(Entries[0].Flink, &ListHead); + ok_eq_pointer(Entries[0].Blink, &Entries[1]); + ok_eq_pointer(Entries[1].Flink, &Entries[0]); + ok_eq_pointer(Entries[1].Blink, &ListHead); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + KmtSetIrql(PASSIVE_LEVEL); +} Propchange: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExSingleList.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExSingleList.c (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExSingleList.c [iso-8859-1] Mon Jul 25 20:12:44 2011 @@ -1,0 +1,128 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite Singly-linked list test + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +struct _SINGLE_LIST_ENTRY; +struct _SINGLE_LIST_ENTRY *__stdcall ExInterlockedPushEntryList(struct _SINGLE_LIST_ENTRY *, struct _SINGLE_LIST_ENTRY *, unsigned long *); +struct _SINGLE_LIST_ENTRY *__stdcall ExInterlockedPopEntryList(struct _SINGLE_LIST_ENTRY *, unsigned long *); + +#include <ntddk.h> +#include <kmt_test.h> + +SINGLE_LIST_ENTRY Entries[5]; + +#define ok_eq_free2(Value, Expected) do \ +{ \ + if (KmtIsCheckedBuild) \ + ok_eq_pointer(Value, (PVOID)0xBADDD0FF); \ + else \ + ok_eq_pointer(Value, Expected); \ +} while (0) + +START_TEST(ExSingleList) +{ + KSPIN_LOCK SpinLock; + SINGLE_LIST_ENTRY ListHead; + PSINGLE_LIST_ENTRY Ret; + + KeInitializeSpinLock(&SpinLock); + + memset(Entries, 0x55, sizeof Entries); + ListHead.Next = NULL; + Ret = ExInterlockedPushEntryList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Next, &Entries[0]); + ok_eq_pointer(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPopEntryList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Next, NULL); + ok_eq_free2(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPopEntryList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Next, NULL); + ok_eq_free2(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPushEntryList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Next, &Entries[0]); + ok_eq_pointer(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPushEntryList(&ListHead, &Entries[1], &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Next, &Entries[1]); + ok_eq_pointer(Entries[1].Next, &Entries[0]); + ok_eq_pointer(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPopEntryList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, &Entries[1]); + ok_eq_pointer(ListHead.Next, &Entries[0]); + ok_eq_free2(Entries[1].Next, &Entries[0]); + ok_eq_pointer(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + +#undef ExInterlockedPushEntryList +#undef ExInterlockedPopEntryList + memset(Entries, 0x55, sizeof Entries); + ListHead.Next = NULL; + Ret = ExInterlockedPushEntryList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Next, &Entries[0]); + ok_eq_pointer(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPopEntryList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Next, NULL); + ok_eq_free2(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPopEntryList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Next, NULL); + ok_eq_free2(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPushEntryList(&ListHead, &Entries[0], &SpinLock); + ok_eq_pointer(Ret, NULL); + ok_eq_pointer(ListHead.Next, &Entries[0]); + ok_eq_pointer(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPushEntryList(&ListHead, &Entries[1], &SpinLock); + ok_eq_pointer(Ret, &Entries[0]); + ok_eq_pointer(ListHead.Next, &Entries[1]); + ok_eq_pointer(Entries[1].Next, &Entries[0]); + ok_eq_pointer(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + Ret = ExInterlockedPopEntryList(&ListHead, &SpinLock); + ok_eq_pointer(Ret, &Entries[1]); + ok_eq_pointer(ListHead.Next, &Entries[0]); + ok_eq_free2(Entries[1].Next, &Entries[0]); + ok_eq_pointer(Entries[0].Next, NULL); + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); + ok_irql(PASSIVE_LEVEL); + + KmtSetIrql(PASSIVE_LEVEL); +} Propchange: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExSingleList.c ------------------------------------------------------------------------------ svn:eol-style = native
13 years, 5 months
1
0
0
0
[tfaber] 52869: [KMTESTS] - add KeSpinLock test - KeIrql: also test the actual stdcall versions of KeRaiseIrql/KeLowerIrql - ExHardError: take advantage of r52847
by tfaber@svn.reactos.org
Author: tfaber Date: Mon Jul 25 20:08:51 2011 New Revision: 52869 URL:
http://svn.reactos.org/svn/reactos?rev=52869&view=rev
Log: [KMTESTS] - add KeSpinLock test - KeIrql: also test the actual stdcall versions of KeRaiseIrql/KeLowerIrql - ExHardError: take advantage of r52847 Added: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeSpinLock.c (with props) Modified: branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExHardError.c branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeIrql.c Modified: branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/C…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt [iso-8859-1] Mon Jul 25 20:08:51 2011 @@ -28,6 +28,7 @@ ntos_ke/KeDpc.c ntos_ke/KeIrql.c ntos_ke/KeProcessor.c + ntos_ke/KeSpinLock.c ntos_ob/ObCreate.c kmtest_drv/kmtest_drv.rc) Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv.rbuild [iso-8859-1] Mon Jul 25 20:08:51 2011 @@ -34,6 +34,7 @@ <file>KeDpc.c</file> <file>KeIrql.c</file> <file>KeProcessor.c</file> + <file>KeSpinLock.c</file> </directory> <directory name="ntos_ob"> <file>ObCreate.c</file> Modified: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExHardError.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExHardError.c [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExHardError.c [iso-8859-1] Mon Jul 25 20:08:51 2011 @@ -14,20 +14,6 @@ /* TODO: don't require user interaction, test Io* routines, * test NTSTATUS values with special handling */ - -/* TODO: this belongs in ndk/exfuncs.h?! */ -NTSTATUS -NTAPI -ExRaiseHardError(IN NTSTATUS ErrorStatus, - IN ULONG NumberOfParameters, - IN ULONG UnicodeStringParameterMask, - IN PULONG_PTR Parameters, - IN ULONG ValidResponseOptions, - OUT PULONG Response); - -/* TODO: this belongs in HARDERROR_RESPONSE_OPTION in ndk/extypes.h */ -#define OptionBalloonNotification 7 -#define OptionCancelTryAgainContinue 8 static VOID @@ -107,125 +93,125 @@ if (InteractivePart1) { - CheckHardError(0x40000000, 0, OptionOk, STATUS_SUCCESS, ResponseOk, 0, 0); // outputs a box :| - CheckHardError(0x40000001, 0, OptionOk, STATUS_SUCCESS, ResponseOk, 4, 1, 2, 3, 4); // outputs a box :| - CheckHardError(0x40000002, 0, OptionOk, STATUS_SUCCESS, ResponseOk, 5, 1, 2, 3, 4, 5); // outputs a box :| - } - CheckHardError(0x40000003, 0, OptionOk, STATUS_SUCCESS, ResponseNotHandled, 6, 1, 2, 3, 4, 5, 6); - - CheckHardError(0x40000004, 0, OptionShutdownSystem, STATUS_PRIVILEGE_NOT_HELD, ResponseNotHandled, 0, 0); - CheckHardError(0x40000005, 0, OptionBalloonNotification, STATUS_SUCCESS, ResponseOk, 0, 0); // outputs a balloon notification - CheckHardError(0x4000000f, 0, OptionBalloonNotification, STATUS_SUCCESS, ResponseOk, 0, 0); // outputs a balloon notification + CheckHardError(0x40000000, 0, OptionOk, STATUS_SUCCESS, ResponseOk, 0, 0); // outputs a box :| + CheckHardError(0x40000001, 0, OptionOk, STATUS_SUCCESS, ResponseOk, 4, 1, 2, 3, 4); // outputs a box :| + CheckHardError(0x40000002, 0, OptionOk, STATUS_SUCCESS, ResponseOk, 5, 1, 2, 3, 4, 5); // outputs a box :| + } + CheckHardError(0x40000003, 0, OptionOk, STATUS_SUCCESS, ResponseNotHandled, 6, 1, 2, 3, 4, 5, 6); + + CheckHardError(0x40000004, 0, OptionShutdownSystem, STATUS_PRIVILEGE_NOT_HELD, ResponseNotHandled, 0, 0); + CheckHardError(0x40000005, 0, OptionOkNoWait, STATUS_SUCCESS, ResponseOk, 0, 0); // outputs a balloon notification + CheckHardError(0x4000000f, 0, OptionOkNoWait, STATUS_SUCCESS, ResponseOk, 0, 0); // outputs a balloon notification if (InteractivePart1) { - CheckHardError(0x40000006, 0, OptionAbortRetryIgnore, STATUS_SUCCESS, ResponseAbort, 0, 0); // outputs a box :| - CheckHardError(0x40000006, 0, OptionAbortRetryIgnore, STATUS_SUCCESS, ResponseRetry, 0, 0); // outputs a box :| - CheckHardError(0x40000006, 0, OptionAbortRetryIgnore, STATUS_SUCCESS, ResponseIgnore, 0, 0); // outputs a box :| - CheckHardError(0x40000008, 0, OptionCancelTryAgainContinue, STATUS_SUCCESS, ResponseCancel, 0, 0); // outputs a box :| - CheckHardError(0x40000008, 0, OptionCancelTryAgainContinue, STATUS_SUCCESS, ResponseTryAgain, 0, 0); // outputs a box :| - CheckHardError(0x40000008, 0, OptionCancelTryAgainContinue, STATUS_SUCCESS, ResponseContinue, 0, 0); // outputs a box :| - CheckHardError(0x40000010, 0, OptionOkCancel, STATUS_SUCCESS, ResponseOk, 0, 0); // outputs a box :| - CheckHardError(0x40000010, 0, OptionOkCancel, STATUS_SUCCESS, ResponseCancel, 0, 0); // outputs a box :| - CheckHardError(0x40000011, 0, OptionRetryCancel, STATUS_SUCCESS, ResponseRetry, 0, 0); // outputs a box :| - CheckHardError(0x40000011, 0, OptionRetryCancel, STATUS_SUCCESS, ResponseCancel, 0, 0); // outputs a box :| - CheckHardError(0x40000012, 0, OptionYesNo, STATUS_SUCCESS, ResponseYes, 0, 0); // outputs a box :| - CheckHardError(0x40000012, 0, OptionYesNo, STATUS_SUCCESS, ResponseNo, 0, 0); // outputs a box :| - CheckHardError(0x40000013, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 0, 0); // outputs a box :| - CheckHardError(0x40000013, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 0, 0); // outputs a box :| - CheckHardError(0x40000013, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, 0); // outputs a box :| - } - CheckHardError(0x40000009, 0, 9, STATUS_SUCCESS, ResponseNotHandled, 0, 0); - CheckHardError(0x4000000a, 0, 10, STATUS_SUCCESS, ResponseNotHandled, 0, 0); - CheckHardError(0x4000000b, 0, 11, STATUS_SUCCESS, ResponseNotHandled, 0, 0); - CheckHardError(0x4000000c, 0, 12, STATUS_SUCCESS, ResponseNotHandled, 0, 0); - CheckHardError(0x4000000d, 0, MAXULONG / 2 + 1, STATUS_SUCCESS, ResponseNotHandled, 0, 0); - CheckHardError(0x4000000d, 0, MAXULONG, STATUS_SUCCESS, ResponseNotHandled, 0, 0); + CheckHardError(0x40000006, 0, OptionAbortRetryIgnore, STATUS_SUCCESS, ResponseAbort, 0, 0); // outputs a box :| + CheckHardError(0x40000006, 0, OptionAbortRetryIgnore, STATUS_SUCCESS, ResponseRetry, 0, 0); // outputs a box :| + CheckHardError(0x40000006, 0, OptionAbortRetryIgnore, STATUS_SUCCESS, ResponseIgnore, 0, 0); // outputs a box :| + CheckHardError(0x40000008, 0, OptionCancelTryContinue, STATUS_SUCCESS, ResponseCancel, 0, 0); // outputs a box :| + CheckHardError(0x40000008, 0, OptionCancelTryContinue, STATUS_SUCCESS, ResponseTryAgain, 0, 0); // outputs a box :| + CheckHardError(0x40000008, 0, OptionCancelTryContinue, STATUS_SUCCESS, ResponseContinue, 0, 0); // outputs a box :| + CheckHardError(0x40000010, 0, OptionOkCancel, STATUS_SUCCESS, ResponseOk, 0, 0); // outputs a box :| + CheckHardError(0x40000010, 0, OptionOkCancel, STATUS_SUCCESS, ResponseCancel, 0, 0); // outputs a box :| + CheckHardError(0x40000011, 0, OptionRetryCancel, STATUS_SUCCESS, ResponseRetry, 0, 0); // outputs a box :| + CheckHardError(0x40000011, 0, OptionRetryCancel, STATUS_SUCCESS, ResponseCancel, 0, 0); // outputs a box :| + CheckHardError(0x40000012, 0, OptionYesNo, STATUS_SUCCESS, ResponseYes, 0, 0); // outputs a box :| + CheckHardError(0x40000012, 0, OptionYesNo, STATUS_SUCCESS, ResponseNo, 0, 0); // outputs a box :| + CheckHardError(0x40000013, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 0, 0); // outputs a box :| + CheckHardError(0x40000013, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 0, 0); // outputs a box :| + CheckHardError(0x40000013, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, 0); // outputs a box :| + } + CheckHardError(0x40000009, 0, 9, STATUS_SUCCESS, ResponseNotHandled, 0, 0); + CheckHardError(0x4000000a, 0, 10, STATUS_SUCCESS, ResponseNotHandled, 0, 0); + CheckHardError(0x4000000b, 0, 11, STATUS_SUCCESS, ResponseNotHandled, 0, 0); + CheckHardError(0x4000000c, 0, 12, STATUS_SUCCESS, ResponseNotHandled, 0, 0); + CheckHardError(0x4000000d, 0, MAXULONG / 2 + 1, STATUS_SUCCESS, ResponseNotHandled, 0, 0); + CheckHardError(0x4000000d, 0, MAXULONG, STATUS_SUCCESS, ResponseNotHandled, 0, 0); if (InteractivePart2) { /* try a message with one parameter */ - CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 1, &String1); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, &String1); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, &String1); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, &String1); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 1, &String1); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, &String1); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, &String1); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, &String1); // outputs a box :| /* give too many parameters */ - CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 2, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 4, &String1, &String2, 0, 0); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 2, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 4, &String1, &String2, 0, 0); // outputs a box :| /* try with stuff that's not a UNICODE_STRING */ - CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, &String1Ansi); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, L"Parameter1"); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, "Parameter1"); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, 1234); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, NULL); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, &String1Ansi); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, L"Parameter1"); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, "Parameter1"); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, 1234); // outputs a box :| - CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, NULL); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, &String1Ansi); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, L"Parameter1"); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, "Parameter1"); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, 1234); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, NULL); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, &String1Ansi); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, L"Parameter1"); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, "Parameter1"); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, 1234); // outputs a box :| + CheckHardError(STATUS_DLL_NOT_FOUND, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, NULL); // outputs a box :| } if (InteractivePart3) { /* try a message with one parameter */ - CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, &String1); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, &String1); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 0, &String1); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 0, &String1); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, &String1); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, &String1); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 0, &String1); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 0, &String1); // outputs a box :| /* give too many parameters */ - CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 2, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseOk, 3, &String1, &String2, 0); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseOk, 4, &String1, &String2, 0, 0); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionBalloonNotification, STATUS_SUCCESS, ResponseOk, 4, &String1, &String2, 0, 0); // outputs a balloon notification + CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 2, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseOk, 3, &String1, &String2, 0); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseOk, 4, &String1, &String2, 0, 0); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 3, OptionOkNoWait, STATUS_SUCCESS, ResponseOk, 4, &String1, &String2, 0, 0); // outputs a balloon notification /* try with stuff that's not a UNICODE_STRING */ - CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, &String1Ansi); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, L"Parameter1"); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, "Parameter1"); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, 1234); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, NULL); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, &String1Ansi); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, L"Parameter1"); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, "Parameter1"); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, 1234); // outputs a box :| - CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, NULL); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, &String1Ansi); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, L"Parameter1"); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, "Parameter1"); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, 1234); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, NULL); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, &String1Ansi); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, L"Parameter1"); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, "Parameter1"); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, 1234); // outputs a box :| + CheckHardError(STATUS_SERVICE_NOTIFICATION, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseNotHandled, 1, NULL); // outputs a box :| } if (InteractivePart4) { /* try a message with one parameter */ - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 1, &String1); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, &String1); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, &String1); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, &String1); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 1, &String1); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, &String1); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, &String1); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 0, &String1); // outputs a box :| /* give too many parameters */ - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 2, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 2, &String1, &String2); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 4, &String1, &String2, 0, 0); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 2, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 2, &String1, &String2); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 3, OptionYesNoCancel, STATUS_SUCCESS, ResponseYes, 4, &String1, &String2, 0, 0); // outputs a box :| /* try with stuff that's not a UNICODE_STRING */ - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, &String1Ansi); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, L"Parameter1"); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, "Parameter1"); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, 1234); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, NULL); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, &String1Ansi); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, L"Parameter1"); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, "Parameter1"); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, 1234); // outputs a box :| - CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, NULL); // outputs a box :| - } - - CheckInformationalHardError(STATUS_WAIT_0, NULL, NULL, STATUS_SUCCESS, TRUE); // outputs a balloon notification - CheckInformationalHardError(STATUS_DLL_NOT_FOUND, &String1, NULL, STATUS_SUCCESS, TRUE); // outputs a balloon notification - CheckInformationalHardError(STATUS_DLL_NOT_FOUND, NULL, NULL, STATUS_SUCCESS, TRUE); // outputs a balloon notification + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, &String1Ansi); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, L"Parameter1"); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_SUCCESS, ResponseNo, 1, "Parameter1"); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, 1234); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, NULL); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, &String1Ansi); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, L"Parameter1"); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, "Parameter1"); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, 1234); // outputs a box :| + CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseCancel, 1, NULL); // outputs a box :| + } + + CheckInformationalHardError(STATUS_WAIT_0, NULL, NULL, STATUS_SUCCESS, TRUE); // outputs a balloon notification + CheckInformationalHardError(STATUS_DLL_NOT_FOUND, &String1, NULL, STATUS_SUCCESS, TRUE); // outputs a balloon notification + CheckInformationalHardError(STATUS_DLL_NOT_FOUND, NULL, NULL, STATUS_SUCCESS, TRUE); // outputs a balloon notification CheckInformationalHardError(STATUS_SERVICE_NOTIFICATION, &String1, NULL, STATUS_SUCCESS, FALSE); ok_bool_true(IoSetThreadHardErrorMode(TRUE), "IoSetThreadHardErrorMode returned"); ok_bool_true(IoSetThreadHardErrorMode(FALSE), "IoSetThreadHardErrorMode returned"); ok_bool_false(IoSetThreadHardErrorMode(FALSE), "IoSetThreadHardErrorMode returned"); - CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseReturnToCaller, 0, 0); - CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, NULL); + CheckHardError(STATUS_FATAL_APP_EXIT, 0, OptionYesNoCancel, STATUS_SUCCESS, ResponseReturnToCaller, 0, 0); + CheckHardError(STATUS_FATAL_APP_EXIT, 1, OptionYesNoCancel, STATUS_ACCESS_VIOLATION, NoResponse, 1, NULL); CheckInformationalHardError(STATUS_WAIT_0, NULL, NULL, STATUS_SUCCESS, FALSE); CheckInformationalHardError(STATUS_DLL_NOT_FOUND, &String1, NULL, STATUS_SUCCESS, FALSE); CheckInformationalHardError(STATUS_DLL_NOT_FOUND, NULL, NULL, STATUS_SUCCESS, FALSE); Modified: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeIrql.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeIrql.c [iso-8859-1] (original) +++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeIrql.c [iso-8859-1] Mon Jul 25 20:08:51 2011 @@ -4,6 +4,9 @@ * PURPOSE: Kernel-Mode Test Suite Interrupt Request Level test * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> */ + +__declspec(dllimport) void __stdcall KeRaiseIrql(unsigned char, unsigned char *); +__declspec(dllimport) void __stdcall KeLowerIrql(unsigned char); #include <ntddk.h> #include <ntifs.h> @@ -134,6 +137,14 @@ KeLowerIrql(PASSIVE_LEVEL); } + /* try the actual exports, not only the fastcall versions */ + ok_irql(PASSIVE_LEVEL); + (KeRaiseIrql)(HIGH_LEVEL, &Irql); + ok_irql(HIGH_LEVEL); + ok_eq_uint(Irql, PASSIVE_LEVEL); + (KeLowerIrql)(Irql); + ok_irql(PASSIVE_LEVEL); + /* make sure we exit gracefully */ ok_irql(PASSIVE_LEVEL); KeLowerIrql(PASSIVE_LEVEL); Added: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeSpinLock.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
============================================================================== --- branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeSpinLock.c (added) +++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeSpinLock.c [iso-8859-1] Mon Jul 25 20:08:51 2011 @@ -1,0 +1,365 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite Spin lock test + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#ifndef _WIN64 +__declspec(dllimport) void __stdcall KeAcquireSpinLock(unsigned long *, unsigned char *); +__declspec(dllimport) void __stdcall KeReleaseSpinLock(unsigned long *, unsigned char); +__declspec(dllimport) void __stdcall KeAcquireSpinLockAtDpcLevel(unsigned long *); +__declspec(dllimport) void __stdcall KeReleaseSpinLockFromDpcLevel(unsigned long *); +#endif + +/* this define makes KeInitializeSpinLock not use the inlined version */ +#define WIN9X_COMPAT_SPINLOCK +#include <ntddk.h> +#include <ntifs.h> +#include <ndk/kefuncs.h> +#include <kmt_test.h> +#include <pseh/pseh2.h> +#include <limits.h> + +//#define NDEBUG +#include <debug.h> + +/* TODO: these are documented for Vista+ */ +NTKERNELAPI +VOID +FASTCALL +KeAcquireInStackQueuedSpinLockForDpc( + IN OUT PKSPIN_LOCK SpinLock, + OUT PKLOCK_QUEUE_HANDLE LockHandle); + +NTKERNELAPI +VOID +FASTCALL +KeReleaseInStackQueuedSpinLockForDpc( + IN PKLOCK_QUEUE_HANDLE LockHandle); + +/* TODO: multiprocessor testing */ + +struct _CHECK_DATA; +typedef struct _CHECK_DATA CHECK_DATA, *PCHECK_DATA; + +typedef VOID (*PACQUIRE_FUNCTION)(PKSPIN_LOCK, PCHECK_DATA); +typedef VOID (*PRELEASE_FUNCTION)(PKSPIN_LOCK, PCHECK_DATA); +typedef BOOLEAN (*PTRY_FUNCTION)(PKSPIN_LOCK, PCHECK_DATA); + +struct _CHECK_DATA +{ + enum + { + CheckQueueHandle, + CheckQueue, + CheckLock + } Check; + KIRQL IrqlWhenAcquired; + PACQUIRE_FUNCTION Acquire; + PRELEASE_FUNCTION Release; + PTRY_FUNCTION TryAcquire; + PACQUIRE_FUNCTION AcquireNoRaise; + PRELEASE_FUNCTION ReleaseNoLower; + PTRY_FUNCTION TryAcquireNoRaise; + KSPIN_LOCK_QUEUE_NUMBER QueueNumber; + BOOLEAN TryRetOnFailure; + KIRQL OriginalIrql; + BOOLEAN IsAcquired; + _ANONYMOUS_UNION union + { + KLOCK_QUEUE_HANDLE QueueHandle; + PKSPIN_LOCK_QUEUE Queue; + KIRQL Irql; + } DUMMYUNIONNAME; + PVOID UntouchedValue; +}; + +#define DEFINE_ACQUIRE(LocalName, SetIsAcquired, DoCall) \ +static VOID LocalName(PKSPIN_LOCK SpinLock, PCHECK_DATA CheckData) \ +{ \ + ASSERT(!CheckData->IsAcquired); \ + DoCall; \ + if (SetIsAcquired) CheckData->IsAcquired = TRUE; \ +} + +#define DEFINE_RELEASE(LocalName, SetIsAcquired, DoCall) \ +static VOID LocalName(PKSPIN_LOCK SpinLock, PCHECK_DATA CheckData) \ +{ \ + DoCall; \ + if (SetIsAcquired) CheckData->IsAcquired = FALSE; \ +} + +DEFINE_ACQUIRE(AcquireNormal, TRUE, KeAcquireSpinLock(SpinLock, &CheckData->Irql)) +DEFINE_RELEASE(ReleaseNormal, TRUE, KeReleaseSpinLock(SpinLock, CheckData->Irql)) +DEFINE_ACQUIRE(AcquireExp, TRUE, (KeAcquireSpinLock)(SpinLock, &CheckData->Irql)) +DEFINE_RELEASE(ReleaseExp, TRUE, (KeReleaseSpinLock)(SpinLock, CheckData->Irql)) +DEFINE_ACQUIRE(AcquireSynch, TRUE, CheckData->Irql = KeAcquireSpinLockRaiseToSynch(SpinLock)) + +DEFINE_ACQUIRE(AcquireInStackQueued, TRUE, KeAcquireInStackQueuedSpinLock(SpinLock, &CheckData->QueueHandle)) +DEFINE_ACQUIRE(AcquireInStackSynch, TRUE, KeAcquireInStackQueuedSpinLockRaiseToSynch(SpinLock, &CheckData->QueueHandle)) +DEFINE_RELEASE(ReleaseInStackQueued, TRUE, KeReleaseInStackQueuedSpinLock(&CheckData->QueueHandle)) + +DEFINE_ACQUIRE(AcquireQueued, TRUE, CheckData->Irql = KeAcquireQueuedSpinLock(CheckData->QueueNumber)) +DEFINE_ACQUIRE(AcquireQueuedSynch, TRUE, CheckData->Irql = KeAcquireQueuedSpinLockRaiseToSynch(CheckData->QueueNumber)) +DEFINE_RELEASE(ReleaseQueued, TRUE, KeReleaseQueuedSpinLock(CheckData->QueueNumber, CheckData->Irql)) + +DEFINE_ACQUIRE(AcquireNoRaise, FALSE, KeAcquireSpinLockAtDpcLevel(SpinLock)) +DEFINE_RELEASE(ReleaseNoLower, FALSE, KeReleaseSpinLockFromDpcLevel(SpinLock)) +DEFINE_ACQUIRE(AcquireExpNoRaise, FALSE, (KeAcquireSpinLockAtDpcLevel)(SpinLock)) +DEFINE_RELEASE(ReleaseExpNoLower, FALSE, (KeReleaseSpinLockFromDpcLevel)(SpinLock)) + +DEFINE_ACQUIRE(AcquireInStackNoRaise, FALSE, KeAcquireInStackQueuedSpinLockAtDpcLevel(SpinLock, &CheckData->QueueHandle)) +DEFINE_RELEASE(ReleaseInStackNoRaise, FALSE, KeReleaseInStackQueuedSpinLockFromDpcLevel(&CheckData->QueueHandle)) + +DEFINE_ACQUIRE(AcquireForDpc, TRUE, CheckData->Irql = KeAcquireSpinLockForDpc(SpinLock)) +DEFINE_RELEASE(ReleaseForDpc, TRUE, KeReleaseSpinLockForDpc(SpinLock, CheckData->Irql)) + +DEFINE_ACQUIRE(AcquireInStackForDpc, FALSE, KeAcquireInStackQueuedSpinLockForDpc(SpinLock, &CheckData->QueueHandle)) +DEFINE_RELEASE(ReleaseInStackForDpc, FALSE, KeReleaseInStackQueuedSpinLockForDpc(&CheckData->QueueHandle)) + +DEFINE_ACQUIRE(AcquireInt, FALSE, KiAcquireSpinLock(SpinLock)) +DEFINE_RELEASE(ReleaseInt, FALSE, KiReleaseSpinLock(SpinLock)) + +BOOLEAN TryQueued(PKSPIN_LOCK SpinLock, PCHECK_DATA CheckData) { + LOGICAL Ret = KeTryToAcquireQueuedSpinLock(CheckData->QueueNumber, &CheckData->Irql); + CheckData->IsAcquired = TRUE; + ASSERT(Ret == FALSE || Ret == TRUE); + return (BOOLEAN)Ret; +} +BOOLEAN TryQueuedSynch(PKSPIN_LOCK SpinLock, PCHECK_DATA CheckData) { + BOOLEAN Ret = KeTryToAcquireQueuedSpinLockRaiseToSynch(CheckData->QueueNumber, &CheckData->Irql); + CheckData->IsAcquired = TRUE; + return Ret; +} +BOOLEAN TryNoRaise(PKSPIN_LOCK SpinLock, PCHECK_DATA CheckData) { + BOOLEAN Ret = KeTryToAcquireSpinLockAtDpcLevel(SpinLock); + return Ret; +} + +#define CheckSpinLockLock(SpinLock, CheckData, Value) do \ +{ \ + PKTHREAD Thread = KeGetCurrentThread(); \ + if (KmtIsMultiProcessorBuild) \ + { \ + ok_eq_bool(Ret, (Value) == 0); \ + if (SpinLock) \ + ok_eq_pointer((PVOID)*(SpinLock), \ + (Value) ? (PVOID)((ULONG_PTR)Thread | 1) : 0); \ + } \ + else \ + { \ + ok_bool_true(Ret, "KeTestSpinLock returned"); \ + if (SpinLock) \ + ok_eq_pointer((PVOID)*(SpinLock), NULL); \ + } \ + ok_eq_uint((CheckData)->Irql, (CheckData)->OriginalIrql); \ +} while (0) + +#define CheckSpinLockQueue(SpinLock, CheckData, Value) do \ +{ \ + ok_eq_pointer((CheckData)->Queue->Next, NULL); \ + ok_eq_pointer((CheckData)->Queue->Lock, NULL); \ + ok_eq_uint((CheckData)->Irql, (CheckData)->OriginalIrql); \ +} while (0) + +#define CheckSpinLockQueueHandle(SpinLock, CheckData, Value) do \ +{ \ + if (KmtIsMultiProcessorBuild) \ + { \ + ok_eq_bool(Ret, (Value) == 0); \ + if (SpinLock) \ + ok_eq_pointer((PVOID)*(SpinLock), \ + (Value) ? &(CheckData)->QueueHandle : 0); \ + ok_eq_pointer((CheckData)->QueueHandle.LockQueue.Next, NULL); \ + ok_eq_pointer((CheckData)->QueueHandle.LockQueue.Lock, \ + (PVOID)((ULONG_PTR)SpinLock | ((Value) ? 2 : 0))); \ + } \ + else \ + { \ + ok_bool_true(Ret, "KeTestSpinLock returned"); \ + if (SpinLock) \ + ok_eq_pointer((PVOID)*(SpinLock), NULL); \ + ok_eq_pointer((CheckData)->QueueHandle.LockQueue.Next, (CheckData)->UntouchedValue); \ + ok_eq_pointer((CheckData)->QueueHandle.LockQueue.Lock, (CheckData)->UntouchedValue); \ + } \ + ok_eq_uint((CheckData)->QueueHandle.OldIrql, (CheckData)->OriginalIrql); \ +} while (0) + +#define CheckSpinLock(SpinLock, CheckData, Value) do \ +{ \ + BOOLEAN Ret = SpinLock ? KeTestSpinLock(SpinLock) : TRUE; \ + KIRQL ExpectedIrql = (CheckData)->OriginalIrql; \ + \ + switch ((CheckData)->Check) \ + { \ + case CheckLock: \ + CheckSpinLockLock(SpinLock, CheckData, Value); \ + break; \ + case CheckQueue: \ + CheckSpinLockQueue(SpinLock, CheckData, Value); \ + break; \ + case CheckQueueHandle: \ + CheckSpinLockQueueHandle(SpinLock, CheckData, Value); \ + break; \ + } \ + \ + if ((CheckData)->IsAcquired) \ + ExpectedIrql = (CheckData)->IrqlWhenAcquired; \ + ok_irql(ExpectedIrql); \ + ok_bool_false(KeAreApcsDisabled(), "KeAreApcsDisabled returned"); \ + ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); \ +} while (0) + +static +VOID +TestSpinLock( + PKSPIN_LOCK SpinLock, + PCHECK_DATA CheckData) +{ + static INT Run = 0; + trace("Test SpinLock run %d\n", Run++); + + ok_irql(CheckData->OriginalIrql); + + if (SpinLock) + ok_eq_pointer((PVOID)*SpinLock, NULL); + CheckData->Acquire(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 1); + CheckData->Release(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 0); + + if (CheckData->TryAcquire) + { + CheckSpinLock(SpinLock, CheckData, 0); + ok_bool_true(CheckData->TryAcquire(SpinLock, CheckData), "TryAcquire returned"); + CheckSpinLock(SpinLock, CheckData, 1); + if (!KmtIsCheckedBuild) + { + /* SPINLOCK_ALREADY_OWNED on checked build */ + ok_bool_true(CheckData->TryAcquire(SpinLock, CheckData), "TryAcquire returned"); + /* even a failing acquire sets irql */ + ok_eq_uint(CheckData->Irql, CheckData->IrqlWhenAcquired); + CheckData->Irql = CheckData->OriginalIrql; + CheckSpinLock(SpinLock, CheckData, 1); + } + CheckData->Release(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 0); + } + + if (CheckData->AcquireNoRaise && + (CheckData->OriginalIrql >= DISPATCH_LEVEL || !KmtIsCheckedBuild)) + { + /* acquire/release without irql change */ + CheckData->AcquireNoRaise(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 1); + CheckData->ReleaseNoLower(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 0); + + /* acquire without raise, but normal release */ + CheckData->AcquireNoRaise(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 1); + CheckData->Release(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 0); + + /* acquire normally but release without lower */ + CheckData->Acquire(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 1); + CheckData->ReleaseNoLower(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 0); + CheckData->IsAcquired = FALSE; + KmtSetIrql(CheckData->OriginalIrql); + + if (CheckData->TryAcquireNoRaise) + { + CheckSpinLock(SpinLock, CheckData, 0); + ok_bool_true(CheckData->TryAcquireNoRaise(SpinLock, CheckData), "TryAcquireNoRaise returned"); + CheckSpinLock(SpinLock, CheckData, 1); + if (!KmtIsCheckedBuild) + { + ok_bool_true(CheckData->TryAcquireNoRaise(SpinLock, CheckData), "TryAcquireNoRaise returned"); + CheckSpinLock(SpinLock, CheckData, 1); + } + CheckData->ReleaseNoLower(SpinLock, CheckData); + CheckSpinLock(SpinLock, CheckData, 0); + } + } + + ok_irql(CheckData->OriginalIrql); + /* make sure we survive this in case of error */ + KmtSetIrql(CheckData->OriginalIrql); +} + +START_TEST(KeSpinLock) +{ + KSPIN_LOCK SpinLock = (KSPIN_LOCK)0x5555555555555555LL; + PKSPIN_LOCK pSpinLock = &SpinLock; + KIRQL Irql, SynchIrql = KmtIsMultiProcessorBuild ? IPI_LEVEL - 2 : DISPATCH_LEVEL; + KIRQL OriginalIrqls[] = { PASSIVE_LEVEL, APC_LEVEL, DISPATCH_LEVEL, HIGH_LEVEL }; + CHECK_DATA TestData[] = + { + { CheckLock, DISPATCH_LEVEL, AcquireNormal, ReleaseNormal, NULL, AcquireNoRaise, ReleaseNoLower, TryNoRaise }, + { CheckLock, DISPATCH_LEVEL, AcquireExp, ReleaseExp, NULL, AcquireExpNoRaise, ReleaseExpNoLower, NULL }, + /* TODO: this one is just weird! + { CheckLock, DISPATCH_LEVEL, AcquireNormal, ReleaseNormal, NULL, AcquireForDpc, ReleaseForDpc, NULL },*/ + { CheckLock, DISPATCH_LEVEL, AcquireNormal, ReleaseNormal, NULL, AcquireInt, ReleaseInt, NULL }, + { CheckLock, SynchIrql, AcquireSynch, ReleaseNormal, NULL, NULL, NULL, NULL }, + { CheckQueueHandle, DISPATCH_LEVEL, AcquireInStackQueued, ReleaseInStackQueued, NULL, AcquireInStackNoRaise, ReleaseInStackNoRaise, NULL }, + { CheckQueueHandle, SynchIrql, AcquireInStackSynch, ReleaseInStackQueued, NULL, NULL, NULL, NULL }, + { CheckQueueHandle, DISPATCH_LEVEL, AcquireInStackQueued, ReleaseInStackQueued, NULL, AcquireInStackForDpc, ReleaseInStackForDpc, NULL }, + { CheckQueue, DISPATCH_LEVEL, AcquireQueued, ReleaseQueued, TryQueued, NULL, NULL, NULL, LockQueuePfnLock }, + { CheckQueue, SynchIrql, AcquireQueuedSynch, ReleaseQueued, TryQueuedSynch, NULL, NULL, NULL, LockQueuePfnLock }, + }; + int i, iIrql; + PKPRCB Prcb = KeGetCurrentPrcb(); + + /* KeInitializeSpinLock */ + memset(&SpinLock, 0x55, sizeof SpinLock); + KeInitializeSpinLock(&SpinLock); + ok_eq_pointer((PVOID)SpinLock, NULL); + + /* KeTestSpinLock */ + ok_bool_true(KeTestSpinLock(&SpinLock), "KeTestSpinLock returned"); + SpinLock = 1; + ok_bool_false(KeTestSpinLock(&SpinLock), "KeTestSpinLock returned"); + SpinLock = 2; + ok_bool_false(KeTestSpinLock(&SpinLock), "KeTestSpinLock returned"); + SpinLock = (ULONG_PTR)-1; + ok_bool_false(KeTestSpinLock(&SpinLock), "KeTestSpinLock returned"); + SpinLock = (ULONG_PTR)1 << (sizeof(ULONG_PTR) * CHAR_BIT - 1); + ok_bool_false(KeTestSpinLock(&SpinLock), "KeTestSpinLock returned"); + SpinLock = 0; + ok_bool_true(KeTestSpinLock(&SpinLock), "KeTestSpinLock returned"); + + /* on UP none of the following functions actually looks at the spinlock! */ + if (!KmtIsMultiProcessorBuild && !KmtIsCheckedBuild) + pSpinLock = NULL; + + for (i = 0; i < sizeof TestData / sizeof TestData[0]; ++i) + { + memset(&SpinLock, 0x55, sizeof SpinLock); + KeInitializeSpinLock(&SpinLock); + if (TestData[i].Check == CheckQueueHandle) + memset(&TestData[i].QueueHandle, 0x55, sizeof TestData[i].QueueHandle); + if (TestData[i].Check == CheckQueue) + { + TestData[i].Queue = &Prcb->LockQueue[TestData[i].QueueNumber]; + TestData[i].UntouchedValue = NULL; + } + else + TestData[i].UntouchedValue = (PVOID)0x5555555555555555LL; + + for (iIrql = 0; iIrql < sizeof OriginalIrqls / sizeof OriginalIrqls[0]; ++iIrql) + { + if (KmtIsCheckedBuild && OriginalIrqls[iIrql] > DISPATCH_LEVEL) + continue; + KeRaiseIrql(OriginalIrqls[iIrql], &Irql); + TestData[i].OriginalIrql = OriginalIrqls[iIrql]; + TestData[i].IsAcquired = FALSE; + TestSpinLock(pSpinLock, &TestData[i]); + KeLowerIrql(Irql); + } + } + + KmtSetIrql(PASSIVE_LEVEL); +} Propchange: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeSpinLock.c ------------------------------------------------------------------------------ svn:eol-style = native
13 years, 5 months
1
0
0
0
[ion] 52868: [KERNEL32]: Fix DPRINT1s.
by ion@svn.reactos.org
Author: ion Date: Mon Jul 25 19:55:43 2011 New Revision: 52868 URL:
http://svn.reactos.org/svn/reactos?rev=52868&view=rev
Log: [KERNEL32]: Fix DPRINT1s. Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] Mon Jul 25 19:55:43 2011 @@ -333,7 +333,7 @@ NULL); if (NT_SUCCESS(Status)) { - DPRINT1("CSD String: %wZ\n", BaseSrvCSDString); + DPRINT1("CSD String: %wZ\n", &BaseSrvCSDString); wcsncpy(BaseStaticServerData->CSDVersion, BaseSrvCSDString.Buffer, BaseSrvCSDString.Length / sizeof(WCHAR)); @@ -361,13 +361,11 @@ NULL); ASSERT(NT_SUCCESS(Status)); - DPRINT1("ReactOS Base API Connected: %wZ %wZ %wZ %S (%lx.%lx) %d KB\n", - BaseStaticServerData->WindowsDirectory, - BaseStaticServerData->WindowsSystemDirectory, - BaseStaticServerData->NamedObjectDirectory, + DPRINT1("ReactOS Base API Connected: %wZ %wZ %wZ %S %d KB\n", + &BaseStaticServerData->WindowsDirectory, + &BaseStaticServerData->WindowsSystemDirectory, + &BaseStaticServerData->NamedObjectDirectory, BaseStaticServerData->CSDVersion, - BaseStaticServerData->CSDNumber, - BaseStaticServerData->RCNumber, BaseStaticServerData->SysInfo.PageSize * BaseStaticServerData->SysInfo.NumberOfPhysicalPages / 1024); }
13 years, 5 months
1
0
0
0
[ion] 52867: [KERNEL32]: Arch, you have to initialize your strings first!
by ion@svn.reactos.org
Author: ion Date: Mon Jul 25 19:26:40 2011 New Revision: 52867 URL:
http://svn.reactos.org/svn/reactos?rev=52867&view=rev
Log: [KERNEL32]: Arch, you have to initialize your strings first! Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c Modified: trunk/reactos/dll/win32/kernel32/client/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/dllmain.c [iso-8859-1] Mon Jul 25 19:26:40 2011 @@ -264,7 +264,7 @@ UNICODE_STRING SystemRootString; UNICODE_STRING UnexpandedSystemRootString = RTL_CONSTANT_STRING(L"%SystemRoot%"); UNICODE_STRING BaseSrvCSDString; - RTL_QUERY_REGISTRY_TABLE BaseServerRegistryConfigurationTable[] = + RTL_QUERY_REGISTRY_TABLE BaseServerRegistryConfigurationTable[2] = { { NULL, @@ -322,6 +322,9 @@ */ BaseStaticServerData->CSDNumber = 0; BaseStaticServerData->RCNumber = 0; + + /* Initialize the CSD string */ + RtlInitEmptyUnicodeString(&BaseSrvCSDString, Buffer, sizeof(Buffer)); Status = RtlQueryRegistryValues(RTL_REGISTRY_WINDOWS_NT, L"",
13 years, 5 months
1
0
0
0
[akhaldi] 52866: [CMAKE] * Add PCH variable (disabled by default) to configure scripts. * Add ccache variable to unix configure script.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Jul 25 19:08:52 2011 New Revision: 52866 URL:
http://svn.reactos.org/svn/reactos?rev=52866&view=rev
Log: [CMAKE] * Add PCH variable (disabled by default) to configure scripts. * Add ccache variable to unix configure script. Modified: trunk/reactos/configure.cmd trunk/reactos/configure.sh Modified: trunk/reactos/configure.cmd URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/configure.cmd?rev=52866&r1…
============================================================================== --- trunk/reactos/configure.cmd [iso-8859-1] (original) +++ trunk/reactos/configure.cmd [iso-8859-1] Mon Jul 25 19:08:52 2011 @@ -139,7 +139,7 @@ ) if "%BUILD_ENVIRONMENT%" == "MinGW" ( - cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% + cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0 -DPCH=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% ) else if "%BUILD_ENVIRONMENT%" == "WDK" ( cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DUSE_WDK_HEADERS=%USE_WDK_HEADERS% -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% ) else ( Modified: trunk/reactos/configure.sh URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/configure.sh?rev=52866&r1=…
============================================================================== --- trunk/reactos/configure.sh [iso-8859-1] (original) +++ trunk/reactos/configure.sh [iso-8859-1] Mon Jul 25 19:08:52 2011 @@ -37,7 +37,7 @@ rm -f CMakeCache.txt fi -cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=$ARCH -DREACTOS_BUILD_TOOLS_DIR="$REACTOS_BUILD_TOOLS_DIR" "$REACTOS_SOURCE_DIR" +cmake -G "Unix Makefiles" -DENABLE_CCACHE=0 -DPCH=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=$ARCH -DREACTOS_BUILD_TOOLS_DIR="$REACTOS_BUILD_TOOLS_DIR" "$REACTOS_SOURCE_DIR" echo Configure script complete! Enter directories and execute appropriate build commands\(ex: make, makex, etc...\).
13 years, 5 months
1
0
0
0
[akhaldi] 52865: [CMAKE] * Introduce a temporary cmake variable (PCH) to enable/disable cmake pch support as this requires our patched binary. * Wrap pch macros around this variable. * Implement th...
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Jul 25 19:05:00 2011 New Revision: 52865 URL:
http://svn.reactos.org/svn/reactos?rev=52865&view=rev
Log: [CMAKE] * Introduce a temporary cmake variable (PCH) to enable/disable cmake pch support as this requires our patched binary. * Wrap pch macros around this variable. * Implement the pch marco accordingly. By Jerome. Modified: trunk/reactos/cmake/gcc.cmake Modified: trunk/reactos/cmake/gcc.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/gcc.cmake?rev=52865&…
============================================================================== --- trunk/reactos/cmake/gcc.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/gcc.cmake [iso-8859-1] Mon Jul 25 19:05:00 2011 @@ -285,44 +285,69 @@ set(PSEH_LIB "pseh") # Macros -macro(_PCH_GET_COMPILE_FLAGS _target_name _out_compile_flags _header_filename) - # Add the precompiled header to the build - get_filename_component(_FILE ${_header_filename} NAME) - set(_gch_filename "${_FILE}.gch") - list(APPEND ${_out_compile_flags} -c ${_header_filename} -o ${_gch_filename}) - - # This gets us our includes - get_directory_property(DIRINC INCLUDE_DIRECTORIES) - foreach(item ${DIRINC}) - list(APPEND ${_out_compile_flags} -I${item}) - endforeach() - - # This our definitions - get_directory_property(_compiler_flags DEFINITIONS) - list(APPEND ${_out_compile_flags} ${_compiler_flags}) - - # This gets any specific definitions that were added with set-target-property - get_target_property(_target_defs ${_target_name} COMPILE_DEFINITIONS) - if (_target_defs) - foreach(item ${_target_defs}) - list(APPEND ${_out_compile_flags} -D${item}) +if(PCH) + macro(_PCH_GET_COMPILE_FLAGS _target_name _out_compile_flags _header_filename) + # Add the precompiled header to the build + get_filename_component(_FILE ${_header_filename} NAME) + set(_gch_filename "${_FILE}.gch") + list(APPEND ${_out_compile_flags} -c ${_header_filename} -o ${_gch_filename}) + + # This gets us our includes + get_directory_property(DIRINC INCLUDE_DIRECTORIES) + foreach(item ${DIRINC}) + list(APPEND ${_out_compile_flags} -I${item}) endforeach() - endif() - - separate_arguments(${_out_compile_flags}) -endmacro() - -macro(add_pch _target_name _FILE) - #set(_header_filename ${CMAKE_CURRENT_SOURCE_DIR}/${_FILE}) - #get_filename_component(_basename ${_FILE} NAME) - #set(_gch_filename ${_basename}.gch) - #_PCH_GET_COMPILE_FLAGS(${_target_name} _args ${_header_filename}) - - #add_custom_command(OUTPUT ${_gch_filename} COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} ${_args} DEPENDS ${_header_filename}) - #get_target_property(_src_files ${_target_name} SOURCES) - #set_source_files_properties(${_src_files} PROPERTIES COMPILE_FLAGS "-Winvalid-pch -fpch-preprocess" #OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_gch_filename}) - #add_linkerflag(${_target_name} "${_gch_filename}") -endmacro() + + # This our definitions + get_directory_property(_compiler_flags DEFINITIONS) + list(APPEND ${_out_compile_flags} ${_compiler_flags}) + + # This gets any specific definitions that were added with set-target-property + get_target_property(_target_defs ${_target_name} COMPILE_DEFINITIONS) + if (_target_defs) + foreach(item ${_target_defs}) + list(APPEND ${_out_compile_flags} -D${item}) + endforeach() + endif() + + if(IS_CPP) + list(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS}) + else() + list(APPEND ${_out_compile_flags} ${CMAKE_C_FLAGS}) + endif() + + separate_arguments(${_out_compile_flags}) + endmacro() + + macro(add_pch _target_name _FILE) + set(_header_filename ${CMAKE_CURRENT_SOURCE_DIR}/${_FILE}) + get_filename_component(_basename ${_FILE} NAME) + set(_gch_filename ${_basename}.gch) + _PCH_GET_COMPILE_FLAGS(${_target_name} _args ${_header_filename}) + + if(IS_CPP) + set(__lang CXX) + set(__compiler ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}) + else() + set(__lang C) + set(__compiler ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}) + endif() + + add_custom_command(OUTPUT ${_gch_filename} COMMAND ${__compiler} ${_args} IMPLICIT_DEPENDS ${__lang} ${_header_filename}) + get_target_property(_src_files ${_target_name} SOURCES) + foreach(_item in ${_src_files}) + get_source_file_property(__src_lang ${_item} LANGUAGE) + if(__src_lang STREQUAL __lang) + set_source_files_properties(${_item} PROPERTIES COMPILE_FLAGS "-fpch-preprocess" OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_gch_filename}) + endif() + endforeach() + #set dependency checking : depends on precompiled header only whixh already depends on deeper header + set_target_properties(${_target_name} PROPERTIES IMPLICIT_DEPENDS_INCLUDE_TRANSFORM "\"${_basename}\"=;<${_basename}>=") + endmacro() +else() + macro(add_pch _target_name _FILE) + endmacro() +endif() macro(CreateBootSectorTarget _target_name _asm_file _object_file _base_address) get_filename_component(OBJECT_PATH ${_object_file} PATH)
13 years, 5 months
1
0
0
0
[cmihail] 52864: [lwIP/TCPIP] - Add queue for connections objects in order to buffer packets that have arrived but have no corresponding receive requests to be assigned to. We buffer these packets ...
by cmihail@svn.reactos.org
Author: cmihail Date: Mon Jul 25 18:45:59 2011 New Revision: 52864 URL:
http://svn.reactos.org/svn/reactos?rev=52864&view=rev
Log: [lwIP/TCPIP] - Add queue for connections objects in order to buffer packets that have arrived but have no corresponding receive requests to be assigned to. We buffer these packets to avoid giving a timeout that could cause throughput slowdowns. Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/titypes.h branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/include/rosip.h branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c Modified: branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/titypes.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/drivers/n…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/titypes.h [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/drivers/network/tcpip/include/titypes.h [iso-8859-1] Mon Jul 25 18:45:59 2011 @@ -268,6 +268,8 @@ LIST_ENTRY SendRequest; /* Queued send requests */ LIST_ENTRY ShutdownRequest;/* Queued shutdown requests */ + LIST_ENTRY PacketQueue; /* Queued received packets waiting to be processed */ + /* Signals */ UINT SignalState; /* Active signals from oskit */ Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] Mon Jul 25 18:45:59 2011 @@ -144,18 +144,32 @@ TCPFinEventHandler(void *arg, err_t err) { PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; + const NTSTATUS status = TCPTranslateError(err); DbgPrint("[IP, TCPFinEventHandler] Called for Connection( 0x%x )-> SocketContext = pcb (0x%x)\n", Connection, Connection->SocketContext); /* Only clear the pointer if the shutdown was caused by an error */ - if (err != ERR_OK) + if ((err != ERR_OK))// && (status != STATUS_REMOTE_DISCONNECT)) { /* We're already closed by the error so we don't want to call lwip_close */ DbgPrint("[IP, TCPFinEventHandler] MAKING Connection( 0x%x )-> SocketContext = pcb (0x%x) NULL\n", Connection, Connection->SocketContext); + + // close all possible callbacks + /*tcp_arg((PTCP_PCB)Connection->SocketContext, NULL); + + if (((PTCP_PCB)Connection->SocketContext)->state != LISTEN) + { + tcp_recv((PTCP_PCB)Connection->SocketContext, NULL); + tcp_sent((PTCP_PCB)Connection->SocketContext, NULL); + tcp_err((PTCP_PCB)Connection->SocketContext, NULL); + } + + tcp_accept((PTCP_PCB)Connection->SocketContext, NULL);*/ + Connection->SocketContext = NULL; } - - FlushAllQueues(Connection, TCPTranslateError(err)); + + FlushAllQueues(Connection, status); DbgPrint("[IP, TCPFinEventHandler] Done\n"); } @@ -305,7 +319,7 @@ u32_t TCPRecvEventHandler(void *arg, struct pbuf *p) { - PCONNECTION_ENDPOINT Connection = arg; + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; PTDI_BUCKET Bucket; PLIST_ENTRY Entry; PIRP Irp; Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Mon Jul 25 18:45:59 2011 @@ -25,7 +25,7 @@ VOID ConnectionFree(PVOID Object) { - PCONNECTION_ENDPOINT Connection = Object; + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)Object; KIRQL OldIrql; TI_DbgPrint(DEBUG_TCP, ("Freeing TCP Endpoint\n")); @@ -41,7 +41,7 @@ PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) { - PCONNECTION_ENDPOINT Connection = + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT) ExAllocatePoolWithTag(NonPagedPool, sizeof(CONNECTION_ENDPOINT), CONN_ENDPT_TAG); if (!Connection) @@ -58,6 +58,7 @@ InitializeListHead(&Connection->ReceiveRequest); InitializeListHead(&Connection->SendRequest); InitializeListHead(&Connection->ShutdownRequest); + InitializeListHead(&Connection->PacketQueue); /* Save client context pointer */ Connection->ClientContext = ClientContext; @@ -407,6 +408,9 @@ { PTDI_BUCKET Bucket; KIRQL OldIrql; + PUCHAR DataBuffer; + UINT DataLen, Received; + NTSTATUS Status; TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Called for %d bytes (on socket %x)\n", ReceiveLength, Connection->SocketContext)); @@ -414,29 +418,38 @@ DbgPrint("[IP, TCPReceiveData] Called for %d bytes (on Connection->SocketContext = 0x%x)\n", ReceiveLength, Connection->SocketContext); - LockObject(Connection, &OldIrql); - - /* Freed in TCPSocketState */ - Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG ); - if( !Bucket ) - { - TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Failed to allocate bucket\n")); + NdisQueryBuffer(Buffer, &DataBuffer, &DataLen); + + Status = LibTCPGetDataFromConnectionQueue(Connection, DataBuffer, DataLen, &Received); + + if (Status == STATUS_PENDING) + { + LockObject(Connection, &OldIrql); + + /* Freed in TCPSocketState */ + Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG ); + if( !Bucket ) + { + TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Failed to allocate bucket\n")); + UnlockObject(Connection, OldIrql); + + return STATUS_NO_MEMORY; + } + + Bucket->Request.RequestNotifyObject = Complete; + Bucket->Request.RequestContext = Context; + *BytesReceived = 0; + + InsertTailList( &Connection->ReceiveRequest, &Bucket->Entry ); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Queued read irp\n")); + UnlockObject(Connection, OldIrql); - return STATUS_NO_MEMORY; - } - - Bucket->Request.RequestNotifyObject = Complete; - Bucket->Request.RequestContext = Context; - *BytesReceived = 0; - - InsertTailList( &Connection->ReceiveRequest, &Bucket->Entry ); - TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Queued read irp\n")); - - UnlockObject(Connection, OldIrql); - - TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Leaving. Status = STATUS_PENDING\n")); - DbgPrint("[IP, TCPReceiveData] Leaving. Status = STATUS_PENDING\n"); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Leaving. Status = STATUS_PENDING\n")); + } + + DbgPrint("[IP, TCPReceiveData] Leaving. Status = %s\n", + Status == STATUS_PENDING? "STATUS_PENDING" : "STATUS_SUCCESS"); return STATUS_PENDING; } Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/include/rosip.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] Mon Jul 25 18:45:59 2011 @@ -6,7 +6,19 @@ #include "lwip/ip_addr.h" #include "tcpip.h" +#ifndef LWIP_TAG + #define LWIP_TAG 'PIwl' +#endif + typedef struct tcp_pcb* PTCP_PCB; + +typedef struct _QUEUE_ENTRY +{ + struct pbuf *p; + LIST_ENTRY ListEntry; +} QUEUE_ENTRY, *PQUEUE_ENTRY; + +NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHAR RecvBuffer, UINT RecvLen, UINT *Received); /* External TCP event handlers */ extern void TCPConnectEventHandler(void *arg, const err_t err); Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c [iso-8859-1] Mon Jul 25 18:45:59 2011 @@ -30,6 +30,93 @@ extern KEVENT TerminationEvent; static +void +LibTCPEmptyQueue(PCONNECTION_ENDPOINT Connection) +{ + PLIST_ENTRY Entry; + PQUEUE_ENTRY qp = NULL; + + ReferenceObject(Connection); + + + while (!IsListEmpty(&Connection->PacketQueue)) + { + DbgPrint("[lwIP, LibTCPEmptyQueue] Removed packet off queue++++\n"); + + Entry = RemoveHeadList(&Connection->PacketQueue); + qp = CONTAINING_RECORD(Entry, QUEUE_ENTRY, ListEntry); + + // reenable this later + //pbuf_free(qp->p); + + ExFreePoolWithTag(qp, LWIP_TAG); + } + + DereferenceObject(Connection); +} + +void LibTCPEnqueuePacket(PCONNECTION_ENDPOINT Connection, struct pbuf *p) +{ + PQUEUE_ENTRY qp; + + qp = (PQUEUE_ENTRY)ExAllocatePoolWithTag(NonPagedPool, sizeof(QUEUE_ENTRY), LWIP_TAG); + qp->p = p; + + ExInterlockedInsertTailList(&Connection->PacketQueue, &qp->ListEntry, &Connection->Lock); +} + +PQUEUE_ENTRY LibTCPDequeuePacket(PCONNECTION_ENDPOINT Connection) +{ + PLIST_ENTRY Entry; + PQUEUE_ENTRY qp = NULL; + + Entry = ExInterlockedRemoveHeadList(&Connection->PacketQueue, &Connection->Lock); + + qp = CONTAINING_RECORD(Entry, QUEUE_ENTRY, ListEntry); + + return qp; +} + +NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHAR RecvBuffer, UINT RecvLen, UINT *Received) +{ + PQUEUE_ENTRY qp; + struct pbuf* p; + NTSTATUS Status = STATUS_PENDING; + + if (!IsListEmpty(&Connection->PacketQueue)) + { + DbgPrint("[lwIP, LibTCPGetDataFromConnectionQueue] Getting packet off the queue\n"); + + qp = LibTCPDequeuePacket(Connection); + p = qp->p; + + RecvLen = MIN(p->tot_len, RecvLen); + + for ((*Received) = 0; (*Received) < RecvLen; *Received += p->len, p = p->next) + { + DbgPrint("[lwIP, LibTCPGetDataFromConnectionQueue] 0x%x: Copying %d bytes to 0x%x from 0x%x\n", + p, p->len, ((PUCHAR)RecvBuffer) + (*Received), p->payload); + + RtlCopyMemory(RecvBuffer + (*Received), p->payload, p->len); + } + + // reenable this later + //pbuf_free(qp->p); + ExFreePoolWithTag(qp, LWIP_TAG); + + Status = STATUS_SUCCESS; + } + else + { + DbgPrint("[lwIP, LibTCPGetPacketFromQueue] Queue is EMPTY\n"); + + Status = STATUS_PENDING; + } + + return Status; +} + +static BOOLEAN WaitForEventSafely(PRKEVENT Event) { @@ -56,7 +143,7 @@ static err_t -InternalSendEventHandler(void *arg, struct tcp_pcb *pcb, const u16_t space) +InternalSendEventHandler(void *arg, PTCP_PCB pcb, const u16_t space) { DbgPrint("[lwIP, InternalSendEventHandler] SendEvent (0x%x, 0x%x, %d)\n", arg, pcb, (unsigned int)space); @@ -75,7 +162,7 @@ static err_t -InternalRecvEventHandler(void *arg, struct tcp_pcb *pcb, struct pbuf *p, const err_t err) +InternalRecvEventHandler(void *arg, PTCP_PCB pcb, struct pbuf *p, const err_t err) { u32_t len; @@ -125,8 +212,13 @@ else { /* We want lwIP to store the pbuf on its queue for later */ - DbgPrint("[lwIP, InternalRecvEventHandler] Done ERR_TIMEOUT\n"); - return ERR_TIMEOUT; + DbgPrint("[lwIP, InternalRecvEventHandler] Done ERR_TIMEOUT queuing pbuf\n"); + + LibTCPEnqueuePacket((PCONNECTION_ENDPOINT)arg, p); + + tcp_recved(pcb, p->tot_len); + + return ERR_OK;//ERR_TIMEOUT;// } } else if (err == ERR_OK) @@ -145,7 +237,7 @@ static err_t -InternalAcceptEventHandler(void *arg, struct tcp_pcb *newpcb, const err_t err) +InternalAcceptEventHandler(void *arg, PTCP_PCB newpcb, const err_t err) { DbgPrint("[lwIP, InternalAcceptEventHandler] AcceptEvent arg = 0x%x, newpcb = 0x%x, err = %d\n", arg, newpcb, (unsigned int)err); @@ -168,7 +260,7 @@ static err_t -InternalConnectEventHandler(void *arg, struct tcp_pcb *pcb, const err_t err) +InternalConnectEventHandler(void *arg, PTCP_PCB pcb, const err_t err) { DbgPrint("[lwIP, InternalConnectEventHandler] ConnectEvent (0x%x, pcb = 0x%x, err = %d)\n", arg, pcb, (unsigned int)err); @@ -686,8 +778,8 @@ if (pcb->state != LISTEN) { tcp_recv(pcb, NULL); - //tcp_sent(pcb, NULL); - //tcp_err(pcb, NULL); + tcp_sent(pcb, NULL); + tcp_err(pcb, NULL); } tcp_accept(pcb, NULL); @@ -705,13 +797,15 @@ { DbgPrint("[lwIP, LibTCPCloseCallback] NULL pcb...bail, bail!!!\n"); - ASSERT(FALSE); + //ASSERT(FALSE); msg->Error = ERR_OK; return; } CloseCallbacks((PTCP_PCB)msg->Connection->SocketContext); + + LibTCPEmptyQueue(msg->Connection); if (((PTCP_PCB)msg->Connection->SocketContext)->state == LISTEN) { @@ -752,6 +846,9 @@ if (safe) { CloseCallbacks((PTCP_PCB)Connection->SocketContext); + + LibTCPEmptyQueue(Connection); + if ( ((PTCP_PCB)Connection->SocketContext)->state == LISTEN ) { DbgPrint("[lwIP, LibTCPClose] Closing a listener\n");
13 years, 5 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
52
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Results per page:
10
25
50
100
200