From 2a5f6261a53bb35a7316444ea66c6249bebef33e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 19 Jul 2010 23:18:31 +0000 Subject: [PATCH 01/21] [FREELDR] Convert freeldr and setupldr to PE format. Previously freeldr was a raw binary file, which made handling by the bootsector very easy, but it disqualified it from proper debugging with gdb using symbols. This is possible with having unstripped PE files. As we don't have any space to do proper PE loading from the bootsector (I already had to trim some strings to get enough space for the new jump code), we need to make sure, that the PE file doesn't contain a .bss section, which is achieved by a linker script. The next thing is to make sure, we don't have any symbols in the output file, because they would make freeldr too big to be loaded into memory and they are useless anyway. On the other hand we like to keep the symbols in the .nostrip.sys files if requested, as this is the primary purpose. This is in theory not a problem, as we could simply strip the file at the end, but binutils throw a monkey wrench in our plans: both strip and objcopy disrespect the file alignment and create unaligned sections, that don't naturally match their VAs. This is solved by hacking rbuild to do invoke ld 2 times, one time without and one time with the symbols (if requested). Now the bootsectors also got some changes: instead of jumping to the loading address (0x8000) they get the address of the entry point from the image optional header. This is slightly simplified, by assuming the NtHeader begins at offset 0xE0. This finally allows source level debugging of freeldr with gdb. svn path=/trunk/; revision=48124 --- reactos/boot/freeldr/bootsect/ext2.asm | 8 ++- reactos/boot/freeldr/bootsect/fat.asm | 10 +++- reactos/boot/freeldr/bootsect/fat32.asm | 9 +-- reactos/boot/freeldr/bootsect/isoboot.asm | 51 ++++++++++------- reactos/boot/freeldr/freeldr/freeldr.rbuild | 13 ++++- reactos/boot/freeldr/freeldr/freeldr_i386.lnk | 57 +++++++++++++++++++ reactos/boot/freeldr/freeldr/setupldr.rbuild | 8 ++- reactos/tools/rbuild/backend/mingw/mingw.cpp | 2 +- .../rbuild/backend/mingw/modulehandler.cpp | 57 +++++++++---------- reactos/tools/rbuild/module.cpp | 5 +- 10 files changed, 150 insertions(+), 70 deletions(-) create mode 100644 reactos/boot/freeldr/freeldr/freeldr_i386.lnk diff --git a/reactos/boot/freeldr/bootsect/ext2.asm b/reactos/boot/freeldr/bootsect/ext2.asm index 51c7a4d0dc2..3dd20a2a883 100644 --- a/reactos/boot/freeldr/bootsect/ext2.asm +++ b/reactos/boot/freeldr/bootsect/ext2.asm @@ -438,9 +438,11 @@ LoadFreeLoader: mov dl,[BYTE bp+BootDrive] mov dh,[BYTE bp+BootPartition] - push byte 0 ; We loaded at 0000:8000 - push WORD 8000h ; We will do a far return to 0000:8000h - retf ; Transfer control to FreeLoader + push 0 ; push segment (0x0000) + mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax + add eax, 0x8000 ; RVA -> VA + push ax ; push offset + retf ; Transfer control to FreeLoader diff --git a/reactos/boot/freeldr/bootsect/fat.asm b/reactos/boot/freeldr/bootsect/fat.asm index 79aac6a5dec..d41db93a15a 100644 --- a/reactos/boot/freeldr/bootsect/fat.asm +++ b/reactos/boot/freeldr/bootsect/fat.asm @@ -209,7 +209,11 @@ FoundFreeLoader: ; because they contain a jump instruction to skip ; over the helper code in the FreeLoader image. ;jmp 0000:8003h - jmp 8003h + push 0 ; push segment (0x0000) + mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax + add eax, 0x8003 ; RVA -> VA and skip 3 bytes (jump to fathelper code) + push ax ; push offset + retf ; Transfer control to FreeLoader @@ -387,10 +391,10 @@ NoCarryCHS: msgDiskError db 'Disk error',0dh,0ah,0 -msgFreeLdr db 'freeldr.sys not found',0dh,0ah,0 +msgFreeLdr db 'ldr not found',0dh,0ah,0 ; Sorry, need the space... ;msgAnyKey db 'Press any key to restart',0dh,0ah,0 -msgAnyKey db 'Press any key',0dh,0ah,0 +msgAnyKey db 'Press a key',0dh,0ah,0 filename db 'FREELDR SYS' times 509-($-$$) db 0 ; Pad to 509 bytes diff --git a/reactos/boot/freeldr/bootsect/fat32.asm b/reactos/boot/freeldr/bootsect/fat32.asm index f2faa93c0f9..81574b31bc2 100644 --- a/reactos/boot/freeldr/bootsect/fat32.asm +++ b/reactos/boot/freeldr/bootsect/fat32.asm @@ -390,11 +390,12 @@ LoadFile: LoadFileDone: mov dl,[BYTE bp+BootDrive] ; Load boot drive into DL mov dh,[BootPartition] ; Load boot partition into DH - xor ax,ax - push ax ; We loaded at 0000:8000 - push WORD 8000h ; We will do a far return to 0000:8000h - retf ; Transfer control to ROSLDR + push 0 ; push segment (0x0000) + mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax + add eax, 0x8000 ; RVA -> VA + push ax ; push offset + retf ; Transfer control to FreeLoader ; Returns the FAT entry for a given cluster number ; On entry EAX has cluster number diff --git a/reactos/boot/freeldr/bootsect/isoboot.asm b/reactos/boot/freeldr/bootsect/isoboot.asm index 054fc5bee78..1192443efb9 100644 --- a/reactos/boot/freeldr/bootsect/isoboot.asm +++ b/reactos/boot/freeldr/bootsect/isoboot.asm @@ -31,7 +31,7 @@ ; **************************************************************************** ; Note: The Makefile builds one version with DEBUG_MESSAGES automatically. -;%define DEBUG_MESSAGES ; Uncomment to get debugging messages +%define DEBUG_MESSAGES ; Uncomment to get debugging messages %define WAIT_FOR_KEY @@ -373,9 +373,20 @@ get_fs_structures: mov dl, [DriveNo] ; dl = boot drive mov dh, 0 ; dh = boot partition - jmp 0:0x8000 ; jump into OSLoader + + push 0 ; push segment (0x0000) + mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax + add eax, 0x8000 ; RVA -> VA + push ax ; push offset + retf ; Transfer control to ROSLDR + + mov eax, [0x8000 + 0xA8] ; load the EntryPoint into eax + add eax, 0x8000 + mov [jmpaddress], eax + db 0xea ; jmp instruction + jmpaddress dd 0 ; ; searchdir: @@ -922,38 +933,38 @@ pollchar_and_empty: isolinux_banner db CR, LF, 'Loading IsoBoot...', CR, LF, 0 -copyright_str db ' Copyright (C) 1994-2002 H. Peter Anvin', CR, LF, 0 +copyright_str db ' (C) 1994-2002 H. Peter Anvin', CR, LF, 0 presskey_msg db 'Press any key to boot from CD', 0 dot_msg db '.',0 %ifdef DEBUG_MESSAGES -startup_msg: db 'Starting up, DL = ', 0 -spec_ok_msg: db 'Loaded spec packet OK, drive = ', 0 -secsize_msg: db 'Sector size appears to be ', 0 -rootloc_msg: db 'Root directory location: ', 0 -rootlen_msg: db 'Root directory length: ', 0 -rootsect_msg: db 'Root directory length(sectors): ', 0 -fileloc_msg: db 'SETUPLDR.SYS location: ', 0 -filelen_msg: db 'SETUPLDR.SYS length: ', 0 -filesect_msg: db 'SETUPLDR.SYS length(sectors): ', 0 +startup_msg: db 'Startup, DL = ', 0 +spec_ok_msg: db 'packet OK, drive = ', 0 +secsize_msg: db 'size appears to be ', 0 +rootloc_msg: db 'Root dir loc: ', 0 +rootlen_msg: db 'Root dir len: ', 0 +rootsect_msg: db 'Root dir len(sect): ', 0 +fileloc_msg: db 'SETUPLDR loc: ', 0 +filelen_msg: db 'SETUPLDR len: ', 0 +filesect_msg: db 'SETUPLDR len(sect): ', 0 findfail_msg: db 'Failed to find file!', 0 startldr_msg: db 'Starting SETUPLDR.SYS', 0 %endif -nosecsize_msg: db 'Failed to get sector size, assuming 0800', CR, LF, 0 -spec_err_msg: db 'Loading spec packet failed, trying to wing it...', CR, LF, 0 -maybe_msg: db 'Found something at drive = ', 0 -alright_msg: db 'Looks like it might be right, continuing...', CR, LF, 0 -nothing_msg: db 'Failed to locate CD-ROM device; boot failed.', CR, LF, 0 +nosecsize_msg: db 'No sector size, assume 0800', CR, LF, 0 +spec_err_msg: db 'Load spec failed, trying wing ...', CR, LF, 0 +maybe_msg: db 'Found smth at drive = ', 0 +alright_msg: db 'might be ok, continuing...', CR, LF, 0 +nothing_msg: db 'Failed locate CD-ROM; boot failed.', CR, LF, 0 isolinux_str db 'IsoBoot: ', 0 crlf_msg db CR, LF, 0 diskerr_msg: db 'Disk error ', 0 ondrive_str: db ', drive ', 0 -err_bootfailed db CR, LF, 'Boot failed: press a key to retry...' +err_bootfailed db CR, LF, 'failed..', 0 isolinux_dir db '\LOADER', 0 -no_dir_msg db 'Could not find the LOADER directory.', CR, LF, 0 +no_dir_msg db 'LOADER dir not found.', CR, LF, 0 isolinux_bin db 'SETUPLDR.SYS', 0 -no_isolinux_msg db 'Could not find SETUPLDR.SYS.', CR, LF, 0 +no_isolinux_msg db 'SETUPLDR not found.', CR, LF, 0 ; ; El Torito spec packet diff --git a/reactos/boot/freeldr/freeldr/freeldr.rbuild b/reactos/boot/freeldr/freeldr/freeldr.rbuild index b513dabca44..70974fda396 100644 --- a/reactos/boot/freeldr/freeldr/freeldr.rbuild +++ b/reactos/boot/freeldr/freeldr/freeldr.rbuild @@ -1,8 +1,14 @@ + + + + + - + + freeldr_$(ARCH).lnk freeldr_startup freeldr_base64k @@ -15,8 +21,9 @@ rtl libcntpr - -static - -lgcc + + -nostartfiles + diff --git a/reactos/boot/freeldr/freeldr/freeldr_i386.lnk b/reactos/boot/freeldr/freeldr/freeldr_i386.lnk new file mode 100644 index 00000000000..48b7b5d9ec5 --- /dev/null +++ b/reactos/boot/freeldr/freeldr/freeldr_i386.lnk @@ -0,0 +1,57 @@ +OUTPUT_FORMAT(pei-i386) +ENTRY(_mainCRTStartup) +SECTIONS +{ + .text __image_base__ + __section_alignment__ : + { + __text_start__ = .; + *(.init) + *(.text) + *(SORT(.text$*)) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(.ctors); *(.ctor); LONG (0); + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); LONG (0); + *(.fini) + /* ??? Why is .gcc_exc here? */ + *(.gcc_exc) + __text_end__ = .; + *(.gcc_except_table) + } + init BLOCK(__section_alignment__) : + { + __init_start__ = . ; + *(init) + __init_end__ = . ; + } + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + *(.data) + *(.data2) + *(SORT(.data$*)) + __data_end__ = . ; + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + } + .rdata BLOCK(__section_alignment__) : + { + *(.rdata) + *(SORT(.rdata$*)) + *(.eh_frame) + } + .stab BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stab ] + } + .stabstr BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stabstr ] + } + +} + diff --git a/reactos/boot/freeldr/freeldr/setupldr.rbuild b/reactos/boot/freeldr/freeldr/setupldr.rbuild index bf41b103c48..f8c62169b29 100644 --- a/reactos/boot/freeldr/freeldr/setupldr.rbuild +++ b/reactos/boot/freeldr/freeldr/setupldr.rbuild @@ -1,6 +1,7 @@ + freeldr_$(ARCH).lnk freeldr_startup freeldr_base64k @@ -15,8 +16,9 @@ rtl libcntpr - -nostartfiles - -nostdlib - -lgcc + + + + -Tbss 0x50000 diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 7afb0da8ff4..98bed1fb873 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -47,7 +47,7 @@ const struct ModuleHandlerInformations ModuleHandlerInformations[] = { { HostFalse, "", "", "$(LDFLAG_DLL)" }, // Win32OCX { HostFalse, "", "", "$(LDFLAG_CONSOLE)" }, // Win32CUI { HostFalse, "", "", "$(LDFLAG_WINDOWS)" }, // Win32GUI - { HostFalse, "", "", "" }, // BootLoader + { HostFalse, "", "", "$(LDFLAG_DRIVER)" }, // BootLoader { HostFalse, "", "-f bin", "" }, // BootSector { HostFalse, "", "", "" }, // Iso { HostFalse, "", "", "" }, // LiveIso diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 8bff6ea0b16..f04c29f0ffe 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -2439,13 +2439,7 @@ void MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget () { fprintf ( fMakefile, "# BOOT LOADER MODULE TARGET\n" ); - string targetName ( module.output->name ); string targetMacro ( GetTargetMacro (module) ); - string workingDirectory = GetWorkingDirectory (); - FileLocation junk_tmp ( TemporaryDirectory, - "", - module.name + ".junk.tmp" ); - CLEAN_FILE ( junk_tmp ); string objectsMacro = GetObjectsMacro ( module ); string libsMacro = GetLibsMacro (); @@ -2460,33 +2454,34 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget () fprintf ( fMakefile, "\t$(ECHO_LD)\n" ); - if (Environment::GetArch() == "arm") - { - fprintf ( fMakefile, - "\t${gcc} -Wl,--subsystem,native -o %s %s %s %s -nostartfiles -nostdlib\n", - backend->GetFullName ( junk_tmp ).c_str (), - objectsMacro.c_str (), - libsMacro.c_str (), - GetLinkerMacro ().c_str ()); + string linkerScriptArgument; + if ( module.linkerScript != NULL ) { + linkerScriptArgument = ssprintf(" -T %s", backend->GetFullName(*module.linkerScript->file).c_str()); } - else - { - fprintf ( fMakefile, - "\t${gcc} -Wl,--subsystem,native -Wl,-Ttext,0x8000 -o %s %s %s %s -nostartfiles -nostdlib\n", - backend->GetFullName ( junk_tmp ).c_str (), - objectsMacro.c_str (), - libsMacro.c_str (), - GetLinkerMacro ().c_str ()); - } - fprintf ( fMakefile, - "\t${objcopy} -O binary %s $@\n", - backend->GetFullName ( junk_tmp ).c_str () ); - GenerateBuildMapCode ( &junk_tmp ); - fprintf ( fMakefile, - "\t-@${rm} %s 2>$(NUL)\n", - backend->GetFullName ( junk_tmp ).c_str () ); - delete target_file; + /* Link the stripped booloader */ + fprintf(fMakefile, + "\t${ld} --strip-all --subsystem native --entry=%s --image-base=%s %s %s $(PROJECT_CCLIBS) " + "$(BUILTIN_LDFLAGS) $(PROJECT_LDFLAGS) $(LDFLAG_DRIVER) %s -o $@\n", + module.GetEntryPoint().c_str(), + module.baseaddress.c_str(), + objectsMacro.c_str(), + libsMacro.c_str(), + linkerScriptArgument.c_str() ); + + /* Link an unstripped version */ + fprintf(fMakefile, + "ifeq ($(ROS_BUILDNOSTRIP),yes)\n" + "\t${ld} --subsystem native --entry=%s --image-base=%s %s %s $(PROJECT_CCLIBS) " + "$(BUILTIN_LDFLAGS) $(PROJECT_LDFLAGS) $(LDFLAG_DRIVER) %s -o %s$(SEP)%s.nostrip.sys\n" + "endif\n", + module.GetEntryPoint().c_str(), + module.baseaddress.c_str(), + objectsMacro.c_str(), + libsMacro.c_str(), + linkerScriptArgument.c_str(), + backend->GetFullPath(*target_file).c_str(), + module.name.c_str()); } diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index 95af1d0c8db..e0c9ff826df 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -1132,6 +1132,7 @@ Module::GetDefaultModuleEntrypoint () const return "DllMain"; case Win32CUI: case Test: + case BootLoader: return "mainCRTStartup"; case Win32SCR: case Win32GUI: @@ -1140,7 +1141,6 @@ Module::GetDefaultModuleEntrypoint () const case StaticLibrary: case HostStaticLibrary: case ObjectLibrary: - case BootLoader: case BootSector: case Iso: case LiveIso: @@ -1187,11 +1187,12 @@ Module::GetDefaultModuleBaseaddress () const return "0x00010000"; case ElfExecutable: return "0xe00000"; + case BootLoader: + return "0x8000"; case BuildTool: case StaticLibrary: case HostStaticLibrary: case ObjectLibrary: - case BootLoader: case BootSector: case Iso: case LiveIso: From a3d974ee28dd911bb6a65b2749678decedc65a4e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 19 Jul 2010 23:47:00 +0000 Subject: [PATCH 02/21] [rpcndr.h] Add a tag to NDR_SCONTEXT struct. MS headers don't have it, but gcc 4.5.x requires it, because without the tag, the struct would be from an unnamed namespace and can't be shared by different compilation units in C++. Yeah whatever... svn path=/trunk/; revision=48125 --- reactos/include/psdk/rpcndr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/psdk/rpcndr.h b/reactos/include/psdk/rpcndr.h index 9691dba9ecd..0164200b98a 100644 --- a/reactos/include/psdk/rpcndr.h +++ b/reactos/include/psdk/rpcndr.h @@ -128,7 +128,7 @@ typedef unsigned char boolean; (RpcExceptionCode() == RPC_X_BAD_STUB_DATA) || \ (RpcExceptionCode() == RPC_S_INVALID_BOUND)) -typedef struct +typedef struct tagNDR_SCONTEXT { void *pad[2]; void *userContext; From d2f3e93b116aad552a1bd6281bf383ac054a81b6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 20 Jul 2010 02:52:40 +0000 Subject: [PATCH 03/21] [sdkddkver.h] Add UL suffix to some constants. svn path=/trunk/; revision=48126 --- reactos/include/psdk/sdkddkver.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/include/psdk/sdkddkver.h b/reactos/include/psdk/sdkddkver.h index 80ed6be22b2..dc0920574c3 100644 --- a/reactos/include/psdk/sdkddkver.h +++ b/reactos/include/psdk/sdkddkver.h @@ -100,9 +100,9 @@ Abstract: #define NTDDI_WIN7 0x06010000 /* Version Fields in NTDDI_VERSION */ -#define OSVERSION_MASK 0xFFFF0000 -#define SPVERSION_MASK 0x0000FF00 -#define SUBVERSION_MASK 0x000000FF +#define OSVERSION_MASK 0xFFFF0000UL +#define SPVERSION_MASK 0x0000FF00UL +#define SUBVERSION_MASK 0x000000FFUL /* Macros to Extract Version Fields From NTDDI_VERSION */ #define OSVER(Version) ((Version) & OSVERSION_MASK) From 0228d0009ebf65bc73ed2f94cf945a620f3f0e59 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 20 Jul 2010 02:53:55 +0000 Subject: [PATCH 04/21] [wine/commctrl.h] Don't use #include_next, instead imclude psdk/commctrl.h svn path=/trunk/; revision=48127 --- reactos/include/reactos/wine/commctrl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/reactos/wine/commctrl.h b/reactos/include/reactos/wine/commctrl.h index 47c3a806d11..a4b5f511f6f 100644 --- a/reactos/include/reactos/wine/commctrl.h +++ b/reactos/include/reactos/wine/commctrl.h @@ -10,7 +10,7 @@ #define _WIN32_IE 0x0501 #endif -#include_next +#include #undef DPA_GetPtr LPVOID WINAPI DPA_GetPtr(HDPA, INT); From ba97a937c29fd832597b38a70bcff5d82c320d6b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 20 Jul 2010 03:01:57 +0000 Subject: [PATCH 05/21] [RBUILD] For amd64 builds, invoke wrc directly, instead of using gcc to preprocess the files. The reason is that newer gcc versions (like 4.5.0) don't support multiline continuation (backslash-newline) except for preprocessor directives, but that breaks wine resource strings. This might have to be done for i386 builds too, sooner or later. svn path=/trunk/; revision=48128 --- reactos/tools/rbuild/backend/mingw/rules.mak | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reactos/tools/rbuild/backend/mingw/rules.mak b/reactos/tools/rbuild/backend/mingw/rules.mak index f83f84fe25d..9990a02ba5a 100644 --- a/reactos/tools/rbuild/backend/mingw/rules.mak +++ b/reactos/tools/rbuild/backend/mingw/rules.mak @@ -227,7 +227,11 @@ else ${call RBUILD_intermediate_path_unique,$(1),$(2)}.res: $(2) $(3) $$(wrc_TARGET) | ${call RBUILD_intermediate_dir,$(2)} $$(ECHO_RC) +ifeq ($(ARCH),amd64) + $$(Q)$$(wrc_TARGET) --input=$$< -o $$@ ${call RBUILD_rc_pp_flags,$(1),$(4)} ${call RBUILD_rc_flags,$(1),$(4),-I${call RBUILD_dir,$(2)}} +else ${call RBUILD_PIPE_CPP,$$<,${call RBUILD_rc_pp_flags,$(1),$(4)}} | $$(wrc_TARGET) -o $$@ ${call RBUILD_rc_flags,$(1),$(4),-I${call RBUILD_dir,$(2)}} +endif endif From 280df5a49bacf028819d0370b3597a8a95247211 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 20 Jul 2010 04:22:04 +0000 Subject: [PATCH 06/21] [CMD] Remove BOMs from rc files. Let me know if something's wrong with that. svn path=/trunk/; revision=48129 --- reactos/base/shell/cmd/lang/de-DE.rc | 2 +- reactos/base/shell/cmd/lang/ja-JP.rc | 2 +- reactos/base/shell/cmd/lang/ru-RU.rc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/base/shell/cmd/lang/de-DE.rc b/reactos/base/shell/cmd/lang/de-DE.rc index c57333d7dec..081f108ec0c 100644 --- a/reactos/base/shell/cmd/lang/de-DE.rc +++ b/reactos/base/shell/cmd/lang/de-DE.rc @@ -1,4 +1,4 @@ -/* +/* * German language file by Klemens Friedl 2005-06-03 * Update: frik85 2005-06-06 */ diff --git a/reactos/base/shell/cmd/lang/ja-JP.rc b/reactos/base/shell/cmd/lang/ja-JP.rc index 10a0792da04..3195f0fbb1d 100644 --- a/reactos/base/shell/cmd/lang/ja-JP.rc +++ b/reactos/base/shell/cmd/lang/ja-JP.rc @@ -1,4 +1,4 @@ -/* +/* * Japanese translation of CMD */ #pragma code_page(65001) diff --git a/reactos/base/shell/cmd/lang/ru-RU.rc b/reactos/base/shell/cmd/lang/ru-RU.rc index d78d6dc4484..97b3d4aef5b 100644 --- a/reactos/base/shell/cmd/lang/ru-RU.rc +++ b/reactos/base/shell/cmd/lang/ru-RU.rc @@ -1,4 +1,4 @@ -/* +/* * Russian language file by * Andrey Korotaev (unC0Rr@inbox.ru) * and From dfd1480154b2355ca696a9904e6a3df6ac460c6a Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 10:14:07 +0000 Subject: [PATCH 07/21] [MINGW-W64] - reactos.diff was pushed upstream, so it's not needed anymore. - Add a missing section. - Include sect_attribs.h into tlssup.c svn path=/trunk/; revision=48130 --- .../include/reactos/mingw-w64/reactos.diff | 83 ------------------- .../include/reactos/mingw-w64/sect_attribs.h | 4 +- reactos/lib/3rdparty/mingw/tlssup.c | 7 +- 3 files changed, 6 insertions(+), 88 deletions(-) delete mode 100644 reactos/include/reactos/mingw-w64/reactos.diff diff --git a/reactos/include/reactos/mingw-w64/reactos.diff b/reactos/include/reactos/mingw-w64/reactos.diff deleted file mode 100644 index 905f7ba3377..00000000000 --- a/reactos/include/reactos/mingw-w64/reactos.diff +++ /dev/null @@ -1,83 +0,0 @@ -Index: internal.h -=================================================================== ---- internal.h (Revision 46537) -+++ internal.h (Arbeitskopie) -@@ -35,6 +35,12 @@ - #define __IOINFO_TM_UTF8 1 - #define __IOINFO_TM_UTF16LE 2 - -+#ifdef _MSC_VER -+#pragma warning(push) -+#pragma warning(disable:4214) -+#pragma warning(disable:4820) -+#endif -+ - typedef struct { - intptr_t osfhnd; - char osfile; -@@ -46,6 +52,10 @@ - char pipech2[2]; - } ioinfo; - -+#ifdef _MSC_VER -+#pragma warning(pop) -+#endif -+ - #define IOINFO_ARRAY_ELTS (1 << 5) - - #define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1))) -Index: oscalls.h -=================================================================== ---- oscalls.h (Revision 46537) -+++ oscalls.h (Arbeitskopie) -@@ -30,6 +30,11 @@ - #endif - #endif - -+#ifdef _MSC_VER -+#pragma warning(push) -+#pragma warning(disable:4214) -+#endif -+ - typedef struct _FTIME - { - unsigned short twosecs : 5; -@@ -46,6 +51,10 @@ - unsigned short year : 7; - } FDATE; - -+#ifdef _MSC_VER -+#pragma warning(pop) -+#endif -+ - typedef FDATE *PFDATE; - - #endif -Index: sect_attribs.h -=================================================================== ---- sect_attribs.h (Revision 46537) -+++ sect_attribs.h (Arbeitskopie) -@@ -10,7 +10,7 @@ - #define _ATTRIBUTES shared - #endif - --#if 0 -+#if defined(_MSC_VER) - /* Reference list of existing section for msvcrt. */ - #pragma section(".CRTMP$XCA",long,_ATTRIBUTES) - #pragma section(".CRTMP$XCZ",long,_ATTRIBUTES) -@@ -55,6 +55,14 @@ - #pragma section(".rtc$IZZ",long,read) - #pragma section(".rtc$TAA",long,read) - #pragma section(".rtc$TZZ",long,read) -+#pragma section(".tls",long,read,write) -+#pragma section(".tls$ZZZ",long,read,write) - #endif - -+#if defined(_MSC_VER) -+#define _CRTALLOC(x) __declspec(allocate(x)) -+#elif defined(__GNUC__) - #define _CRTALLOC(x) __attribute__ ((section (x) )) -+#else -+#error -+#endif diff --git a/reactos/include/reactos/mingw-w64/sect_attribs.h b/reactos/include/reactos/mingw-w64/sect_attribs.h index 8dde10a6552..ff58c0664f3 100644 --- a/reactos/include/reactos/mingw-w64/sect_attribs.h +++ b/reactos/include/reactos/mingw-w64/sect_attribs.h @@ -55,7 +55,9 @@ #pragma section(".rtc$IZZ",long,read) #pragma section(".rtc$TAA",long,read) #pragma section(".rtc$TZZ",long,read) +/* for tlssup.c: */ #pragma section(".tls",long,read,write) +#pragma section(".tls$AAA",long,read,write) #pragma section(".tls$ZZZ",long,read,write) #endif @@ -64,5 +66,5 @@ #elif defined(__GNUC__) #define _CRTALLOC(x) __attribute__ ((section (x) )) #else -#error +#error Your compiler is not supported. #endif diff --git a/reactos/lib/3rdparty/mingw/tlssup.c b/reactos/lib/3rdparty/mingw/tlssup.c index aec217dba5e..8153fb6f2bf 100644 --- a/reactos/lib/3rdparty/mingw/tlssup.c +++ b/reactos/lib/3rdparty/mingw/tlssup.c @@ -10,15 +10,14 @@ #undef CRTDLL #endif +#include + #include + #include #include #include -#ifndef _CRTALLOC -#define _CRTALLOC(x) __attribute__ ((section (x) )) -#endif - #ifndef __INTERNAL_FUNC_DEFINED #define __INTERNAL_FUNC_DEFINED typedef void (__cdecl *_PVFV)(void); From 5be505d1b40adebbcb9836674370e9e2352a30d4 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 12:10:10 +0000 Subject: [PATCH 08/21] [MINGW-W64] - Define WIN32_LEAN_AND_MEAN. - Include stdlib.h for _winmajor. svn path=/trunk/; revision=48131 --- reactos/lib/3rdparty/mingw/tlssup.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/reactos/lib/3rdparty/mingw/tlssup.c b/reactos/lib/3rdparty/mingw/tlssup.c index 8153fb6f2bf..1c32d0d62a6 100644 --- a/reactos/lib/3rdparty/mingw/tlssup.c +++ b/reactos/lib/3rdparty/mingw/tlssup.c @@ -12,17 +12,23 @@ #include +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif #include #include #include #include +#ifndef _WIN64 +#include /* for _winmajor */ +#endif #ifndef __INTERNAL_FUNC_DEFINED #define __INTERNAL_FUNC_DEFINED - typedef void (__cdecl *_PVFV)(void); - typedef int (__cdecl *_PIFV)(void); - typedef void (__cdecl *_PVFI)(int); +typedef void (__cdecl *_PVFV)(void); +typedef int (__cdecl *_PIFV)(void); +typedef void (__cdecl *_PVFI)(int); #endif extern WINBOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved); @@ -208,5 +214,5 @@ _CRTALLOC(".CRT$XLD") PIMAGE_TLS_CALLBACK __xl_d = (PIMAGE_TLS_CALLBACK) __dyn_t int mingw_initltsdrot_force = 0; -int mingw_initltsdyn_force=0; +int mingw_initltsdyn_force = 0; int mingw_initltssuo_force = 0; From 8d15da936a73fb6ac7cdb4b07d0842feb5b9496f Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 12:11:17 +0000 Subject: [PATCH 09/21] [ACPI] - Define WIN32 when compiling with MSVC svn path=/trunk/; revision=48132 --- reactos/drivers/bus/acpi/acpi.rbuild | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/drivers/bus/acpi/acpi.rbuild b/reactos/drivers/bus/acpi/acpi.rbuild index 334cdfc7024..f11b6942b44 100644 --- a/reactos/drivers/bus/acpi/acpi.rbuild +++ b/reactos/drivers/bus/acpi/acpi.rbuild @@ -11,6 +11,11 @@ + + + + + From a92f03aea3c40fd727d840ffbc5592e753bf4947 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 13:04:56 +0000 Subject: [PATCH 10/21] [MINGW-W64] - Group MSVC related definitions. svn path=/trunk/; revision=48133 --- reactos/include/reactos/mingw-w64/sect_attribs.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reactos/include/reactos/mingw-w64/sect_attribs.h b/reactos/include/reactos/mingw-w64/sect_attribs.h index ff58c0664f3..6e59216dbde 100644 --- a/reactos/include/reactos/mingw-w64/sect_attribs.h +++ b/reactos/include/reactos/mingw-w64/sect_attribs.h @@ -4,13 +4,14 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#if defined (__ia64__) || defined (__x86_64) +#if defined(_MSC_VER) + +#if defined(_M_IA64) || defined(_M_AMD64) #define _ATTRIBUTES #else #define _ATTRIBUTES shared #endif -#if defined(_MSC_VER) /* Reference list of existing section for msvcrt. */ #pragma section(".CRTMP$XCA",long,_ATTRIBUTES) #pragma section(".CRTMP$XCZ",long,_ATTRIBUTES) @@ -59,7 +60,7 @@ #pragma section(".tls",long,read,write) #pragma section(".tls$AAA",long,read,write) #pragma section(".tls$ZZZ",long,read,write) -#endif +#endif /* _MSC_VER */ #if defined(_MSC_VER) #define _CRTALLOC(x) __declspec(allocate(x)) @@ -68,3 +69,4 @@ #else #error Your compiler is not supported. #endif + From 357f79fba6d4eb5a2426b394c8f23f9185d96c96 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 14:11:43 +0000 Subject: [PATCH 11/21] [HEADERS] - Make the header inclusion MSVC compatible. svn path=/trunk/; revision=48134 --- reactos/include/reactos/wine/ddk/winsplp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/reactos/wine/ddk/winsplp.h b/reactos/include/reactos/wine/ddk/winsplp.h index 5014e086511..c848e3f1605 100644 --- a/reactos/include/reactos/wine/ddk/winsplp.h +++ b/reactos/include/reactos/wine/ddk/winsplp.h @@ -1,2 +1,2 @@ -#include_next +#include From bc9f1e46f1e71ec9cd6b0f427d7bfafb4f274946 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 14:15:51 +0000 Subject: [PATCH 12/21] [HEADERS] - Make the header inclusion MSVC compatible. - localspl now compiles with MSVC. svn path=/trunk/; revision=48135 --- reactos/include/reactos/wine/ddk/winddiui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/reactos/wine/ddk/winddiui.h b/reactos/include/reactos/wine/ddk/winddiui.h index 35939098e85..8ee549785c2 100644 --- a/reactos/include/reactos/wine/ddk/winddiui.h +++ b/reactos/include/reactos/wine/ddk/winddiui.h @@ -1,2 +1,2 @@ -#include_next +#include From 96353a57211b7f8c41f9fadb5a14559b4275c405 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 20 Jul 2010 15:45:53 +0000 Subject: [PATCH 13/21] [FREELDR] - Update isobtrt.asm to handle new PE bootloader, should fix bootcdregtest - Disable debugging in isoboot.asm svn path=/trunk/; revision=48136 --- reactos/boot/freeldr/bootsect/isoboot.asm | 15 ++++----------- reactos/boot/freeldr/bootsect/isobtrt.asm | 6 +++++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/reactos/boot/freeldr/bootsect/isoboot.asm b/reactos/boot/freeldr/bootsect/isoboot.asm index 1192443efb9..28bf414557c 100644 --- a/reactos/boot/freeldr/bootsect/isoboot.asm +++ b/reactos/boot/freeldr/bootsect/isoboot.asm @@ -31,7 +31,7 @@ ; **************************************************************************** ; Note: The Makefile builds one version with DEBUG_MESSAGES automatically. -%define DEBUG_MESSAGES ; Uncomment to get debugging messages +;%define DEBUG_MESSAGES ; Uncomment to get debugging messages %define WAIT_FOR_KEY @@ -373,20 +373,13 @@ get_fs_structures: mov dl, [DriveNo] ; dl = boot drive mov dh, 0 ; dh = boot partition - push 0 ; push segment (0x0000) mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax - add eax, 0x8000 ; RVA -> VA - push ax ; push offset - retf ; Transfer control to ROSLDR - - mov eax, [0x8000 + 0xA8] ; load the EntryPoint into eax - add eax, 0x8000 - mov [jmpaddress], eax + add eax, 0x8000 ; RVA -> VA + push ax ; push offset + retf ; Transfer control to ROSLDR - db 0xea ; jmp instruction - jmpaddress dd 0 ; ; searchdir: diff --git a/reactos/boot/freeldr/bootsect/isobtrt.asm b/reactos/boot/freeldr/bootsect/isobtrt.asm index 92ca7645162..31b96780607 100644 --- a/reactos/boot/freeldr/bootsect/isobtrt.asm +++ b/reactos/boot/freeldr/bootsect/isobtrt.asm @@ -345,7 +345,11 @@ get_fs_structures: mov dl, [DriveNo] ; dl = boot drive mov dh, 0 ; dh = boot partition - jmp 0:0x8000 ; jump into OSLoader + push 0 ; push segment (0x0000) + mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax + add eax, 0x8000 ; RVA -> VA + push ax ; push offset + retf ; Transfer control to ROSLDR From 88db16e943d37ac01166174dd4b77dce131bda6e Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 15:51:44 +0000 Subject: [PATCH 14/21] [HEADERS] - Make the header inclusion MSVC compatible. - compstui now compiles with MSVC. svn path=/trunk/; revision=48137 --- reactos/include/reactos/wine/ddk/compstui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/include/reactos/wine/ddk/compstui.h b/reactos/include/reactos/wine/ddk/compstui.h index affe933d161..9b63ff291ae 100644 --- a/reactos/include/reactos/wine/ddk/compstui.h +++ b/reactos/include/reactos/wine/ddk/compstui.h @@ -1,2 +1,2 @@ -#include_next +#include From 2bb936ad9710a01b5510c05d860c75887a96fd4c Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Tue, 20 Jul 2010 16:37:22 +0000 Subject: [PATCH 15/21] Remove BOM from UTF-8 rc files. svn path=/trunk/; revision=48138 --- reactos/dll/cpl/intl/lang/ro-RO.rc | 2 +- reactos/dll/cpl/sysdm/lang/ro-RO.rc | 2 +- reactos/dll/win32/devmgr/lang/ro-RO.rc | 2 +- reactos/dll/win32/msgina/lang/ro-RO.rc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/dll/cpl/intl/lang/ro-RO.rc b/reactos/dll/cpl/intl/lang/ro-RO.rc index 366453baef2..621985509ac 100644 --- a/reactos/dll/cpl/intl/lang/ro-RO.rc +++ b/reactos/dll/cpl/intl/lang/ro-RO.rc @@ -1,4 +1,4 @@ -LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL #pragma code_page(65001) diff --git a/reactos/dll/cpl/sysdm/lang/ro-RO.rc b/reactos/dll/cpl/sysdm/lang/ro-RO.rc index ea9ea85bf1c..26c61341a7f 100644 --- a/reactos/dll/cpl/sysdm/lang/ro-RO.rc +++ b/reactos/dll/cpl/sysdm/lang/ro-RO.rc @@ -1,4 +1,4 @@ -LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL #pragma code_page(65001) diff --git a/reactos/dll/win32/devmgr/lang/ro-RO.rc b/reactos/dll/win32/devmgr/lang/ro-RO.rc index b7b578c4e31..7722df63d70 100644 --- a/reactos/dll/win32/devmgr/lang/ro-RO.rc +++ b/reactos/dll/win32/devmgr/lang/ro-RO.rc @@ -1,4 +1,4 @@ -// Romanian language resource file (Petru Dimitriu, 2009-07-15) +// Romanian language resource file (Petru Dimitriu, 2009-07-15) LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL diff --git a/reactos/dll/win32/msgina/lang/ro-RO.rc b/reactos/dll/win32/msgina/lang/ro-RO.rc index b02a01c484b..6eae821cfe9 100644 --- a/reactos/dll/win32/msgina/lang/ro-RO.rc +++ b/reactos/dll/win32/msgina/lang/ro-RO.rc @@ -1,4 +1,4 @@ -LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL #pragma code_page(65001) From bd8190afa71cf34225ea501e4b00e58526d51310 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 20 Jul 2010 18:32:28 +0000 Subject: [PATCH 16/21] [EVENTVWR] Add missing newline at end of file svn path=/trunk/; revision=48139 --- reactos/base/applications/mscutils/eventvwr/lang/en-US.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/base/applications/mscutils/eventvwr/lang/en-US.rc b/reactos/base/applications/mscutils/eventvwr/lang/en-US.rc index 74a6c9f7730..68ae4ba4743 100644 --- a/reactos/base/applications/mscutils/eventvwr/lang/en-US.rc +++ b/reactos/base/applications/mscutils/eventvwr/lang/en-US.rc @@ -114,4 +114,4 @@ BEGIN IDS_COLUMNUSER "User" IDS_COLUMNCOMPUTER "Computer" IDS_COLUMNEVENTDATA "Event Data" -END \ No newline at end of file +END From 154520a060349f8c0cdd5746e0cd20099c7d94ea Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 20 Jul 2010 19:10:02 +0000 Subject: [PATCH 17/21] [ACCESS] WRC doesn't like (x+x+x+2+x+x+x+x+x+x), use (x+x+x+x+x+x+x+x+x+2) instead. To figure out the reason is left as an exercise for the reader. svn path=/trunk/; revision=48140 --- reactos/dll/cpl/access/resource.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/cpl/access/resource.h b/reactos/dll/cpl/access/resource.h index 04ab1183ddf..1b8ac9be741 100644 --- a/reactos/dll/cpl/access/resource.h +++ b/reactos/dll/cpl/access/resource.h @@ -5,7 +5,7 @@ #define PROPSHEETHEIGHT 228 #define PROPSHEETPADDING(x) (x+x+x+x+x+x) #define SYSTEM_COLUMN (18*PROPSHEETPADDING) -#define LABELLINE(x) (x+x+x+2+x+x+x+x+x+x) +#define LABELLINE(x) (x+x+x+x+x+x+x+x+x+2) #define ICONSIZE 16 From fc502885bc74324d5ed1aaa22f639338324d3fad Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 19:15:30 +0000 Subject: [PATCH 18/21] [FORMATTING] - No functionality change. svn path=/trunk/; revision=48141 --- reactos/lib/3rdparty/mingw/CRT_fp10.c | 12 +++++++----- reactos/lib/3rdparty/mingw/CRT_fp8.c | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/reactos/lib/3rdparty/mingw/CRT_fp10.c b/reactos/lib/3rdparty/mingw/CRT_fp10.c index b81937edcd6..21a86135069 100644 --- a/reactos/lib/3rdparty/mingw/CRT_fp10.c +++ b/reactos/lib/3rdparty/mingw/CRT_fp10.c @@ -7,16 +7,18 @@ void _fpreset (void); void _fpreset (void) -{ +{ #ifdef __GNUC__ - __asm__ ("fninit" ); -#else - __asm fninit; + __asm__ ("fninit"); +#else /* msvc: */ + __asm fninit; #endif } #ifdef __GNUC__ void __attribute__ ((alias ("_fpreset"))) fpreset(void); #else -void fpreset(void) { _fpreset(); } +void fpreset(void) { + _fpreset(); +} #endif diff --git a/reactos/lib/3rdparty/mingw/CRT_fp8.c b/reactos/lib/3rdparty/mingw/CRT_fp8.c index e7921f1739f..4a00b8668f8 100644 --- a/reactos/lib/3rdparty/mingw/CRT_fp8.c +++ b/reactos/lib/3rdparty/mingw/CRT_fp8.c @@ -17,5 +17,7 @@ void _fpreset (void) #ifdef __GNUC__ void __attribute__ ((alias ("_fpreset"))) fpreset(void); #else -void fpreset(void) { _fpreset(); } +void fpreset(void) { + _fpreset(); +} #endif From d0588d00640dfd20d98465b5002e84171674c047 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 19:18:03 +0000 Subject: [PATCH 19/21] [MINGW-W64] - MSVC compatibility fixes. svn path=/trunk/; revision=48142 --- reactos/lib/3rdparty/mingw/crtexe.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reactos/lib/3rdparty/mingw/crtexe.c b/reactos/lib/3rdparty/mingw/crtexe.c index 71c934e8ad1..ce76fc19321 100644 --- a/reactos/lib/3rdparty/mingw/crtexe.c +++ b/reactos/lib/3rdparty/mingw/crtexe.c @@ -20,6 +20,7 @@ #include #include #include +#include #ifndef __winitenv extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); @@ -51,7 +52,11 @@ extern int * __MINGW_IMP_SYMBOL(_commode); #define _commode (* __MINGW_IMP_SYMBOL(_commode)) extern int _dowildcard; +#if defined(__GNUC__) int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0; +#else +int _MINGW_INSTALL_DEBUG_MATHERR = 0; +#endif extern int __defaultmatherr; extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *); From 3f25e73244606686f381ae05f1b339e4489988b1 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Tue, 20 Jul 2010 19:20:37 +0000 Subject: [PATCH 20/21] [MINGW-W64] - Wrap MSVC intrinsics onto GCC builtins. - Mark 'cookie' as an __UNUSED_PARAM. - Tighten up _WIN64 conditioning. svn path=/trunk/; revision=48143 --- reactos/lib/3rdparty/mingw/gs_support.c | 33 +++++++++++-------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/reactos/lib/3rdparty/mingw/gs_support.c b/reactos/lib/3rdparty/mingw/gs_support.c index 12aa3f6cb88..4be8fe45736 100644 --- a/reactos/lib/3rdparty/mingw/gs_support.c +++ b/reactos/lib/3rdparty/mingw/gs_support.c @@ -88,19 +88,25 @@ __security_init_cookie (void) __security_cookie_complement = ~cookie; } + +#if defined(__GNUC__) /* wrap msvc intrinsics onto gcc builtins */ +#undef _ReturnAddress +#undef _AddressOfReturnAddress +#define _ReturnAddress() __builtin_return_address(0) +#define _AddressOfReturnAddress() __builtin_frame_address (0) +#endif /* __GNUC__ */ + __declspec(noreturn) void __cdecl __report_gsfailure (ULONGLONG); __declspec(noreturn) void __cdecl __report_gsfailure (ULONGLONG StackCookie) { - volatile UINT_PTR cookie[2]; + volatile UINT_PTR __UNUSED_PARAM(cookie[2]); #ifdef _WIN64 ULONG64 controlPC, imgBase, establisherFrame; PRUNTIME_FUNCTION fctEntry; PVOID hndData; -#endif -#ifdef _WIN64 RtlCaptureContext (&GS_ContextRecord); controlPC = GS_ContextRecord.Rip; fctEntry = RtlLookupFunctionEntry (controlPC, &imgBase, NULL); @@ -110,25 +116,15 @@ __report_gsfailure (ULONGLONG StackCookie) &GS_ContextRecord, &hndData, &establisherFrame, NULL); } else -#endif +#endif /* _WIN64 */ { -#ifdef __GNUC__ -#ifdef _WIN64 - GS_ContextRecord.Rip = (ULONGLONG) __builtin_return_address (0); - GS_ContextRecord.Rsp = (ULONGLONG) __builtin_frame_address (0) + 8; -#else - GS_ContextRecord.Eip = (DWORD) __builtin_return_address (0); - GS_ContextRecord.Esp = (DWORD) __builtin_frame_address (0) + 4; -#endif -#else #ifdef _WIN64 GS_ContextRecord.Rip = (ULONGLONG) _ReturnAddress(); - GS_ContextRecord.Rsp = (ULONGLONG) _AddressOfReturnAddress(); + GS_ContextRecord.Rsp = (ULONGLONG) _AddressOfReturnAddress() + 8; #else GS_ContextRecord.Eip = (DWORD) _ReturnAddress(); - GS_ContextRecord.Esp = (DWORD) _AddressOfReturnAddress(); -#endif -#endif + GS_ContextRecord.Esp = (DWORD) _AddressOfReturnAddress() + 4; +#endif /* _WIN64 */ } #ifdef _WIN64 @@ -137,7 +133,7 @@ __report_gsfailure (ULONGLONG StackCookie) #else GS_ExceptionRecord.ExceptionAddress = (PVOID) GS_ContextRecord.Eip; GS_ContextRecord.Ecx = StackCookie; -#endif +#endif /* _WIN64 */ GS_ExceptionRecord.ExceptionCode = STATUS_STACK_BUFFER_OVERRUN; GS_ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE; cookie[0] = __security_cookie; @@ -147,3 +143,4 @@ __report_gsfailure (ULONGLONG StackCookie) TerminateProcess (GetCurrentProcess (), STATUS_STACK_BUFFER_OVERRUN); abort(); } + From a9b1042fdf73e84b968305d20ade48443f0720a5 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 20 Jul 2010 19:38:22 +0000 Subject: [PATCH 21/21] [NTOSKRNL/FREELDR] Add amd64 linker scripts svn path=/trunk/; revision=48144 --- .../boot/freeldr/freeldr/freeldr_amd64.lnk | 57 ++++++ reactos/ntoskrnl/ntoskrnl_amd64.lnk | 174 ++++++++++++++++++ 2 files changed, 231 insertions(+) create mode 100644 reactos/boot/freeldr/freeldr/freeldr_amd64.lnk create mode 100644 reactos/ntoskrnl/ntoskrnl_amd64.lnk diff --git a/reactos/boot/freeldr/freeldr/freeldr_amd64.lnk b/reactos/boot/freeldr/freeldr/freeldr_amd64.lnk new file mode 100644 index 00000000000..bb677e8ef6f --- /dev/null +++ b/reactos/boot/freeldr/freeldr/freeldr_amd64.lnk @@ -0,0 +1,57 @@ +OUTPUT_FORMAT(pei-x86-64) +ENTRY(_mainCRTStartup) +SECTIONS +{ + .text __image_base__ + __section_alignment__ : + { + __text_start__ = .; + *(.init) + *(.text) + *(SORT(.text$*)) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(.ctors); *(.ctor); LONG (0); + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); LONG (0); + *(.fini) + /* ??? Why is .gcc_exc here? */ + *(.gcc_exc) + __text_end__ = .; + *(.gcc_except_table) + } + init BLOCK(__section_alignment__) : + { + __init_start__ = . ; + *(init) + __init_end__ = . ; + } + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + *(.data) + *(.data2) + *(SORT(.data$*)) + __data_end__ = . ; + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + } + .rdata BLOCK(__section_alignment__) : + { + *(.rdata) + *(SORT(.rdata$*)) + *(.eh_frame) + } + .stab BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stab ] + } + .stabstr BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stabstr ] + } + +} + diff --git a/reactos/ntoskrnl/ntoskrnl_amd64.lnk b/reactos/ntoskrnl/ntoskrnl_amd64.lnk new file mode 100644 index 00000000000..c8ea8e4cd6d --- /dev/null +++ b/reactos/ntoskrnl/ntoskrnl_amd64.lnk @@ -0,0 +1,174 @@ +OUTPUT_FORMAT(pei-x86-64) +ENTRY(_mainCRTStartup) +SECTIONS +{ + .text __image_base__ + __section_alignment__ : + { + __text_start__ = .; + *(.init) + *(.text) + *(SORT(.text$*)) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(.ctors); *(.ctor); LONG (0); + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); LONG (0); + *(.fini) + /* ??? Why is .gcc_exc here? */ + *(.gcc_exc) + __text_end__ = .; + *(.gcc_except_table) + } + init BLOCK(__section_alignment__) : + { + __init_start__ = . ; + *(init) + __init_end__ = . ; + } + /* The Cygwin32 library uses a section to avoid copying certain data + on fork. This used to be named ".data". The linker used + to include this between __data_start__ and __data_end__, but that + breaks building the cygwin32 dll. Instead, we name the section + ".data_cygwin_nocopy" and explictly include it after __data_end__. */ + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + *(.data) + *(.data2) + *(SORT(.data$*)) + __data_end__ = . ; + *(.data_cygwin_nocopy) + } + .rdata BLOCK(__section_alignment__) : + { + *(.rdata) + *(SORT(.rdata$*)) + /* For some reason mingw likes to merge it here. I don't! */ + /* *(.eh_frame) */ + } + .edata BLOCK(__section_alignment__) : + { + *(.edata) + } + /DISCARD/ : + { + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + } + + .idata BLOCK(__section_alignment__) : + { + /* This cannot currently be handled with grouped sections. + See pe.em:sort_sections. */ + SORT(*)(.idata$2) + SORT(*)(.idata$3) + /* These zeroes mark the end of the import list. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + } + .CRT BLOCK(__section_alignment__) : + { + *(SORT(.CRT$*)) + } + .rsrc BLOCK(__section_alignment__) : + { + *(.rsrc) + *(SORT(.rsrc$*)) + } + .bss BLOCK(__section_alignment__) : + { + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + } + .reloc BLOCK(__section_alignment__) : + { + *(.reloc) + /* These zeroes mark the end of the reloc section. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + } + .stab BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stab ] + } + .stabstr BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stabstr ] + } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section. Unlike other targets that fake this by putting the + section VMA at 0, the PE format will not allow it. */ + /* DWARF 1.1 and DWARF 2. */ + .debug_aranges BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_aranges) + } + .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_pubnames) + } + /* DWARF 2. */ + .debug_info BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_info) *(.gnu.linkonce.wi.*) + } + .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_abbrev) + } + .debug_line BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_line) + } + .debug_frame BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_frame) + } + .debug_str BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_str) + } + .debug_loc BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_loc) + } + .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_macinfo) + } + /* SGI/MIPS DWARF 2 extensions. */ + .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_weaknames) + } + .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_funcnames) + } + .debug_typenames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_typenames) + } + .debug_varnames BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_varnames) + } + /* DWARF 3. */ + .debug_ranges BLOCK(__section_alignment__) (NOLOAD) : + { + *(.debug_ranges) + } + .eh_frame BLOCK(__section_alignment__) : + { + *(.eh_frame) + } +} +