From a5f255df138cdc94e330c7e6187d92e9576a9d21 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 15 Jun 2011 18:28:10 +0000 Subject: [PATCH] =?UTF-8?q?[FREELDR]=20use=20baseaddress=20of=20=C3=9Fx100?= =?UTF-8?q?00=20on=20MSVC=20builds.=20This=20doesn't=20yet=20work=20on=20g?= =?UTF-8?q?cc,=20because=20we=20still=20have=2016=20bit=20code=20inside=20?= =?UTF-8?q?the=20PE,=20that=20must=20reside=20below=2064k?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=52249 --- reactos/boot/freeldr/bootsect/isoboot.S | 8 ++++++++ reactos/boot/freeldr/freeldr/CMakeLists.txt | 14 ++++++++++++-- .../freeldr/freeldr/include/arch/pc/x86common.h | 5 +++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/reactos/boot/freeldr/bootsect/isoboot.S b/reactos/boot/freeldr/bootsect/isoboot.S index d7d0bac8494..ecbd34a809b 100644 --- a/reactos/boot/freeldr/bootsect/isoboot.S +++ b/reactos/boot/freeldr/bootsect/isoboot.S @@ -359,7 +359,11 @@ get_fs_structures: call crlf #endif +#ifdef _USE_ML + mov bx, HEX(F000) // bx = load address +#else mov bx, HEX(8000) // bx = load address +#endif mov si, di // restore file pointer mov cx, HEX(0FFFF) // load the whole file call getfssec // get the whole file @@ -374,7 +378,11 @@ get_fs_structures: mov dh, 0 // dh = boot partition /* Transfer execution to the bootloader */ +#ifdef _USE_ML + ljmp16 0, HEX(F000) +#else ljmp16 0, HEX(8000) +#endif // // searchdir: diff --git a/reactos/boot/freeldr/freeldr/CMakeLists.txt b/reactos/boot/freeldr/freeldr/CMakeLists.txt index 5e0c24a309b..21ed84d2e7e 100644 --- a/reactos/boot/freeldr/freeldr/CMakeLists.txt +++ b/reactos/boot/freeldr/freeldr/CMakeLists.txt @@ -24,6 +24,7 @@ if(ARCH MATCHES i386) arch/i386/i386bug.c) else() list(APPEND FREELDR_BASE64K_SOURCE + arch/i386/entry.S arch/i386/realmode.S) endif() elseif(ARCH MATCHES amd64) @@ -168,10 +169,17 @@ set_source_files_properties(${FREELDR_ARCH_SOURCE} PROPERTIES COMPILE_DEFINITION add_library(freeldr_arch ${FREELDR_ARCH_SOURCE}) add_dependencies(freeldr_arch bugcodes) +if (NOT MSVC) CreateBootSectorTarget2(frldr16 ${CMAKE_CURRENT_SOURCE_DIR}/arch/realmode/i386.S ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin 8000) +else() +CreateBootSectorTarget2(frldr16 + ${CMAKE_CURRENT_SOURCE_DIR}/arch/realmode/i386.S + ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin + F000) +endif() list(APPEND FREELDR_SOURCE bootmgr.c @@ -183,12 +191,13 @@ add_executable(freeldr_pe ${FREELDR_SOURCE}) if(NOT MSVC) set_target_properties(freeldr_pe PROPERTIES LINK_FLAGS "-Wl,--strip-all -Wl,--exclude-all-symbols -Wl,--file-alignment,0x1000 -Wl,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lnk") + set_image_base(freeldr_pe 0x9000) else() set_target_properties(freeldr_pe PROPERTIES LINK_FLAGS "/ignore:4078 /ignore:4254 /DRIVER /FIXED /ALIGN:0x400 /SECTION:.text,ERW /SECTION:.data,RW /MERGE:.text16=.text /MERGE:.data=.text /MERGE:.rdata=.text /MERGE:.bss=.text /SUBSYSTEM:BOOT_APPLICATION") + set_image_base(freeldr_pe 0x10000) endif() set_subsystem(freeldr_pe native) -set_image_base(freeldr_pe 0x9000) set_entrypoint(freeldr_pe RealEntryPoint) if(ARCH MATCHES i386) @@ -237,12 +246,13 @@ add_executable(setupldr_pe ${SETUPLDR_SOURCE}) if(NOT MSVC) set_target_properties(setupldr_pe PROPERTIES LINK_FLAGS "-Wl,--strip-all -Wl,--exclude-all-symbols -Wl,--file-alignment,0x1000 -Wl,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lnk" COMPILE_DEFINITIONS "FREELDR_REACTOS_SETUP") + set_image_base(setupldr_pe 0x9000) else() set_target_properties(setupldr_pe PROPERTIES LINK_FLAGS "/DRIVER /SECTION:.text,ERWP,ALIGN=0x1000" COMPILE_DEFINITIONS "FREELDR_REACTOS_SETUP") + set_image_base(setupldr_pe 0x10000) endif() set_subsystem(setupldr_pe native) -set_image_base(setupldr_pe 0x9000) set_entrypoint(setupldr_pe RealEntryPoint) if(ARCH MATCHES i386) diff --git a/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h b/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h index 47854fa9ecf..483f2ccf6a3 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h +++ b/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h @@ -6,8 +6,13 @@ /* Memory layout */ #define STACK16ADDR HEX(6F00) /* The 16-bit stack top will be at 0000:6F00 */ #define BSS_START HEX(6F00) +#if defined(_USE_ML) || defined(_MSC_VER) +#define FREELDR_BASE HEX(f000) +#define FREELDR_PE_BASE HEX(10000) +#else #define FREELDR_BASE HEX(8000) #define FREELDR_PE_BASE HEX(9000) +#endif #define STACK32ADDR HEX(78000) /* The 32-bit stack top will be at 7000:8000, or 0x78000 */ #define BIOSCALLBUFFER HEX(78000) /* Buffer to store temporary data for any Int386() call */ #define BIOSCALLBUFSEGMENT HEX(7800) /* Buffer to store temporary data for any Int386() call */