[FREELDR]

use a dll instead of an exe for the freeldr_pe and setupldr_pe targets and add a spec file to export scsiport stuff. This is the first step in cleaning up the scsiport import hack in freeldr

svn path=/trunk/; revision=53914
This commit is contained in:
Timo Kreuzer 2011-10-01 12:14:45 +00:00
parent 21ee8eb586
commit 6130e7f546
4 changed files with 82 additions and 21 deletions

View file

@ -1,4 +1,6 @@
spec2def(freeldr.sys freeldr.spec)
if(ARCH MATCHES i386)
CreateBootSectorTarget2(frldr16
${CMAKE_CURRENT_SOURCE_DIR}/arch/realmode/i386.S
@ -126,6 +128,7 @@ elseif(ARCH MATCHES amd64)
arch/i386/hardware.c
arch/i386/hwacpi.c
arch/i386/hwapm.c
arch/i386/hwdisk.c
arch/i386/hwpci.c
arch/i386/i386rtl.c
arch/i386/i386disk.c
@ -155,8 +158,12 @@ list(APPEND FREELDR_BASE_SOURCE
rtl/bget.c
rtl/libsupp.c)
add_executable(freeldr_pe ${FREELDR_BASE_SOURCE})
add_executable(freeldr_pe_dbg EXCLUDE_FROM_ALL ${FREELDR_BASE_SOURCE})
if (NOT MSVC)
list(APPEND FREELDR_BASE_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.def)
endif()
add_library(freeldr_pe SHARED ${FREELDR_BASE_SOURCE})
add_library(freeldr_pe_dbg SHARED EXCLUDE_FROM_ALL ${FREELDR_BASE_SOURCE})
if(NOT MSVC)
set_target_properties(freeldr_pe PROPERTIES LINK_FLAGS "-Wl,--strip-all,--exclude-all-symbols,--file-alignment,0x1000,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lnk")
@ -202,7 +209,7 @@ add_dependencies(freeldr_pe_dbg asm)
concatenate_files(
${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
${CMAKE_CURRENT_BINARY_DIR}/freeldr_pe.exe
freeldr_pe
${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys)
add_custom_target(freeldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys)
@ -218,8 +225,8 @@ if(ARCH MATCHES i386 OR ARCH MATCHES amd64)
list(APPEND SETUPLDR_SOURCE windows/setupldr.c)
endif()
add_executable(setupldr_pe ${FREELDR_BASE_SOURCE} ${SETUPLDR_SOURCE})
add_executable(setupldr_pe_dbg EXCLUDE_FROM_ALL ${FREELDR_BASE_SOURCE} ${SETUPLDR_SOURCE})
add_library(setupldr_pe SHARED ${FREELDR_BASE_SOURCE} ${SETUPLDR_SOURCE})
add_library(setupldr_pe_dbg SHARED EXCLUDE_FROM_ALL ${FREELDR_BASE_SOURCE} ${SETUPLDR_SOURCE})
if(NOT MSVC)
set_target_properties(setupldr_pe PROPERTIES LINK_FLAGS "-Wl,--strip-all,--exclude-all-symbols,--file-alignment,0x1000,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lnk" COMPILE_DEFINITIONS "FREELDR_REACTOS_SETUP")
@ -263,7 +270,7 @@ add_dependencies(setupldr_pe_dbg asm)
concatenate_files(
${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
${CMAKE_CURRENT_BINARY_DIR}/setupldr_pe.exe
setupldr_pe
${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys)
add_custom_target(setupldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys)

View file

@ -0,0 +1,46 @@
@ cdecl ScsiDebugPrint()
@ stdcall ScsiPortCompleteRequest(ptr long long long long)
@ stdcall ScsiPortConvertPhysicalAddressToUlong(long long)
@ stdcall -arch=i386 ScsiPortConvertUlongToPhysicalAddress(long)
@ stdcall -arch=x86_64 ScsiPortConvertUlongToPhysicalAddress(long)
@ stdcall ScsiPortFlushDma(ptr)
@ stdcall ScsiPortFreeDeviceBase(ptr ptr)
@ stdcall ScsiPortGetBusData(ptr long long long ptr long)
@ stdcall ScsiPortGetDeviceBase(ptr long long long long long long)
@ stdcall ScsiPortGetLogicalUnit(ptr long long long)
@ stdcall ScsiPortGetPhysicalAddress(ptr ptr ptr long)
@ stdcall ScsiPortGetSrb(ptr long long long long)
@ stdcall ScsiPortGetUncachedExtension(ptr ptr long)
@ stdcall ScsiPortGetVirtualAddress(ptr long long)
@ stdcall ScsiPortInitialize(ptr ptr ptr ptr)
@ stdcall ScsiPortIoMapTransfer(ptr ptr long long)
@ stdcall ScsiPortLogError(ptr ptr long long long long long)
@ stdcall ScsiPortMoveMemory(ptr ptr long)
@ cdecl ScsiPortNotification()
@ stdcall ScsiPortReadPortBufferUchar(ptr ptr long)
@ stdcall ScsiPortReadPortBufferUshort(ptr ptr long)
@ stdcall ScsiPortReadPortBufferUlong(ptr ptr long)
@ stdcall ScsiPortReadPortUchar(ptr)
@ stdcall ScsiPortReadPortUshort(ptr)
@ stdcall ScsiPortReadPortUlong(ptr)
@ stdcall ScsiPortReadRegisterBufferUchar(ptr ptr long)
@ stdcall ScsiPortReadRegisterBufferUshort(ptr ptr long)
@ stdcall ScsiPortReadRegisterBufferUlong(ptr ptr long)
@ stdcall ScsiPortReadRegisterUchar(ptr)
@ stdcall ScsiPortReadRegisterUshort(ptr)
@ stdcall ScsiPortReadRegisterUlong(ptr)
@ stdcall ScsiPortSetBusDataByOffset(ptr long long long ptr long long)
@ stdcall ScsiPortStallExecution(long)
@ stdcall ScsiPortValidateRange(ptr long long long long long long)
@ stdcall ScsiPortWritePortBufferUchar(ptr ptr long)
@ stdcall ScsiPortWritePortBufferUshort(ptr ptr long)
@ stdcall ScsiPortWritePortBufferUlong(ptr ptr long)
@ stdcall ScsiPortWritePortUchar(ptr long)
@ stdcall ScsiPortWritePortUshort(ptr long)
@ stdcall ScsiPortWritePortUlong(ptr long)
@ stdcall ScsiPortWriteRegisterBufferUchar(ptr ptr long)
@ stdcall ScsiPortWriteRegisterBufferUshort(ptr ptr long)
@ stdcall ScsiPortWriteRegisterBufferUlong(ptr ptr long)
@ stdcall ScsiPortWriteRegisterUchar(ptr long)
@ stdcall ScsiPortWriteRegisterUshort(ptr long)
@ stdcall ScsiPortWriteRegisterUlong(ptr long)

View file

@ -10,6 +10,11 @@ SECTIONS
*(SORT(.rdata*))
}
.edata BLOCK(__file_alignment__) :
{
*(.edata)
}
.bss :
{
__bss_start__ = . ;

View file

@ -207,7 +207,9 @@ if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
string(REPLACE "/" "\\" ${_native_path} "${_cmake_path}")
endmacro()
function(concatenate_files _file1 _file2 _output)
# yeah the parameter mess sucks, but thats what works...
function(concatenate_files _file1 _target2 _output)
get_target_property(_file2 ${_target2} LOCATION)
to_win_path("${_file1}" _real_file1)
to_win_path("${_file2}" _real_file2)
to_win_path("${_output}" _real_output)
@ -215,15 +217,16 @@ if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
OUTPUT ${_output}
COMMAND cmd.exe /C "copy /Y /B ${_real_file1} + ${_real_file2} ${_real_output} > nul"
DEPENDS ${_file1}
DEPENDS ${_file2})
DEPENDS ${_target2})
endfunction()
else()
macro(concatenate_files _file1 _file2 _output)
macro(concatenate_files _file1 _target2 _output)
get_target_property(_file2 ${_target2} LOCATION)
add_custom_command(
OUTPUT ${_output}
COMMAND cat ${_file1} ${_file2} > ${_output}
DEPENDS ${_file1}
DEPENDS ${_file2})
DEPENDS ${_target2})
endmacro()
endif()
@ -242,7 +245,7 @@ endfunction()
function(set_module_type MODULE TYPE)
cmake_parse_arguments(__module "UNICODE" "IMAGEBASE" "ENTRYPOINT" ${ARGN})
if(__module_UNPARSED_ARGUMENTS)
message(STATUS "set_module_type : unparsed arguments ${__module_UNPARSED_ARGUMENTS}, module : ${MODULE}")
endif()
@ -258,16 +261,16 @@ function(set_module_type MODULE TYPE)
elseif(NOT ((${TYPE} STREQUAL win32dll) OR (${TYPE} STREQUAL win32ocx) OR (${TYPE} STREQUAL cpl)))
message(FATAL_ERROR "Unknown type ${TYPE} for module ${MODULE}")
endif()
if(DEFINED __subsystem)
set_subsystem(${MODULE} ${__subsystem})
endif()
#set unicode definitions
if(__module_UNICODE)
add_target_compile_definitions(${MODULE} UNICODE _UNICODE)
endif()
# set entry point
if(__module_ENTRYPOINT OR (__module_ENTRYPOINT STREQUAL "0"))
list(GET __module_ENTRYPOINT 0 __entrypoint)
@ -298,7 +301,7 @@ function(set_module_type MODULE TYPE)
set(__entrypoint DllMain)
set(__entrystack 12)
endif()
if(DEFINED __entrypoint)
if(DEFINED __entrystack)
set_entrypoint(${MODULE} ${__entrypoint} ${__entrystack})
@ -306,7 +309,7 @@ function(set_module_type MODULE TYPE)
set_entrypoint(${MODULE} ${__entrypoint})
endif()
endif()
#set base address
if(__module_IMAGEBASE)
set_image_base(${MODULE} __module_IMAGEBASE)
@ -319,21 +322,21 @@ function(set_module_type MODULE TYPE)
elseif(${TYPE} STREQUAL kernelmodedriver)
set_image_base(${MODULE} 0x00010000)
endif()
# Now do some stuff which is specific to each type
# Now do some stuff which is specific to each type
if(${TYPE} STREQUAL kernelmodedriver)
add_dependencies(${MODULE} bugcodes)
set_target_properties(${MODULE} PROPERTIES SUFFIX ".sys")
endif()
if(${TYPE} STREQUAL win32ocx)
set_target_properties(${MODULE} PROPERTIES SUFFIX ".ocx")
endif()
if(${TYPE} STREQUAL cpl)
set_target_properties(${MODULE} PROPERTIES SUFFIX ".cpl")
endif()
# do compiler specific stuff
set_module_type_toolchain(${MODULE} ${TYPE})
endfunction()