Sync with trunk (r48144)

svn path=/branches/reactos-yarotows/; revision=48150
This commit is contained in:
Jérôme Gardou 2010-07-20 22:15:42 +00:00
commit 251d21958c
33 changed files with 420 additions and 171 deletions

View file

@ -1,4 +1,4 @@
/* /*
* German language file by Klemens Friedl <frik85> 2005-06-03 * German language file by Klemens Friedl <frik85> 2005-06-03
* Update: frik85 2005-06-06 * Update: frik85 2005-06-06
*/ */

View file

@ -1,4 +1,4 @@
/* /*
* Japanese translation of CMD * Japanese translation of CMD
*/ */
#pragma code_page(65001) #pragma code_page(65001)

View file

@ -1,4 +1,4 @@
/* /*
* Russian language file by * Russian language file by
* Andrey Korotaev (unC0Rr@inbox.ru) * Andrey Korotaev (unC0Rr@inbox.ru)
* and * and

View file

@ -438,9 +438,11 @@ LoadFreeLoader:
mov dl,[BYTE bp+BootDrive] mov dl,[BYTE bp+BootDrive]
mov dh,[BYTE bp+BootPartition] mov dh,[BYTE bp+BootPartition]
push byte 0 ; We loaded at 0000:8000 push 0 ; push segment (0x0000)
push WORD 8000h ; We will do a far return to 0000:8000h mov eax, [0x8000 + 0xA8] ; load the RVA of the EntryPoint into eax
retf ; Transfer control to FreeLoader add eax, 0x8000 ; RVA -> VA
push ax ; push offset
retf ; Transfer control to FreeLoader

View file

@ -209,7 +209,11 @@ FoundFreeLoader:
; because they contain a jump instruction to skip ; because they contain a jump instruction to skip
; over the helper code in the FreeLoader image. ; over the helper code in the FreeLoader image.
;jmp 0000:8003h ;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 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... ; Sorry, need the space...
;msgAnyKey db 'Press any key to restart',0dh,0ah,0 ;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' filename db 'FREELDR SYS'
times 509-($-$$) db 0 ; Pad to 509 bytes times 509-($-$$) db 0 ; Pad to 509 bytes

View file

@ -390,11 +390,12 @@ LoadFile:
LoadFileDone: LoadFileDone:
mov dl,[BYTE bp+BootDrive] ; Load boot drive into DL mov dl,[BYTE bp+BootDrive] ; Load boot drive into DL
mov dh,[BootPartition] ; Load boot partition into DH 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 ; Returns the FAT entry for a given cluster number
; On entry EAX has cluster number ; On entry EAX has cluster number

View file

@ -373,7 +373,11 @@ get_fs_structures:
mov dl, [DriveNo] ; dl = boot drive mov dl, [DriveNo] ; dl = boot drive
mov dh, 0 ; dh = boot partition 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
@ -922,38 +926,38 @@ pollchar_and_empty:
isolinux_banner db CR, LF, 'Loading IsoBoot...', CR, LF, 0 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 presskey_msg db 'Press any key to boot from CD', 0
dot_msg db '.',0 dot_msg db '.',0
%ifdef DEBUG_MESSAGES %ifdef DEBUG_MESSAGES
startup_msg: db 'Starting up, DL = ', 0 startup_msg: db 'Startup, DL = ', 0
spec_ok_msg: db 'Loaded spec packet OK, drive = ', 0 spec_ok_msg: db 'packet OK, drive = ', 0
secsize_msg: db 'Sector size appears to be ', 0 secsize_msg: db 'size appears to be ', 0
rootloc_msg: db 'Root directory location: ', 0 rootloc_msg: db 'Root dir loc: ', 0
rootlen_msg: db 'Root directory length: ', 0 rootlen_msg: db 'Root dir len: ', 0
rootsect_msg: db 'Root directory length(sectors): ', 0 rootsect_msg: db 'Root dir len(sect): ', 0
fileloc_msg: db 'SETUPLDR.SYS location: ', 0 fileloc_msg: db 'SETUPLDR loc: ', 0
filelen_msg: db 'SETUPLDR.SYS length: ', 0 filelen_msg: db 'SETUPLDR len: ', 0
filesect_msg: db 'SETUPLDR.SYS length(sectors): ', 0 filesect_msg: db 'SETUPLDR len(sect): ', 0
findfail_msg: db 'Failed to find file!', 0 findfail_msg: db 'Failed to find file!', 0
startldr_msg: db 'Starting SETUPLDR.SYS', 0 startldr_msg: db 'Starting SETUPLDR.SYS', 0
%endif %endif
nosecsize_msg: db 'Failed to get sector size, assuming 0800', CR, LF, 0 nosecsize_msg: db 'No sector size, assume 0800', CR, LF, 0
spec_err_msg: db 'Loading spec packet failed, trying to wing it...', CR, LF, 0 spec_err_msg: db 'Load spec failed, trying wing ...', CR, LF, 0
maybe_msg: db 'Found something at drive = ', 0 maybe_msg: db 'Found smth at drive = ', 0
alright_msg: db 'Looks like it might be right, continuing...', CR, LF, 0 alright_msg: db 'might be ok, continuing...', CR, LF, 0
nothing_msg: db 'Failed to locate CD-ROM device; boot failed.', CR, LF, 0 nothing_msg: db 'Failed locate CD-ROM; boot failed.', CR, LF, 0
isolinux_str db 'IsoBoot: ', 0 isolinux_str db 'IsoBoot: ', 0
crlf_msg db CR, LF, 0 crlf_msg db CR, LF, 0
diskerr_msg: db 'Disk error ', 0 diskerr_msg: db 'Disk error ', 0
ondrive_str: db ', drive ', 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 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 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 ; El Torito spec packet

View file

@ -345,7 +345,11 @@ get_fs_structures:
mov dl, [DriveNo] ; dl = boot drive mov dl, [DriveNo] ; dl = boot drive
mov dh, 0 ; dh = boot partition 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

View file

@ -1,8 +1,14 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<if property="ARCH" value="i386">
<property name="BASEADDRESS_FREELDR" value="0x8000" />
<endif>
<!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd"> <!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
<group> <group>
<if property="ARCH" value="i386"> <if property="ARCH" value="i386">
<module name="freeldr" type="bootloader"> <module name="freeldr" type="bootloader" baseaddress="$(BASEADDRESS_FREELDR)">
<linkerscript>freeldr_$(ARCH).lnk</linkerscript>
<bootstrap installbase="loader" /> <bootstrap installbase="loader" />
<library>freeldr_startup</library> <library>freeldr_startup</library>
<library>freeldr_base64k</library> <library>freeldr_base64k</library>
@ -15,8 +21,9 @@
<library>rtl</library> <library>rtl</library>
<library>libcntpr</library> <library>libcntpr</library>
<group linkerset="ld"> <group linkerset="ld">
<linkerflag>-static</linkerflag> <!-- linkerflag>-static</linkerflag -->
<linkerflag>-lgcc</linkerflag> <linkerflag>-nostartfiles</linkerflag>
</group> </group>
</module> </module>
</if> </if>

View file

@ -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 ]
}
}

View file

@ -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 ]
}
}

View file

@ -1,6 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="setupldr" type="bootloader"> <module name="setupldr" type="bootloader">
<linkerscript>freeldr_$(ARCH).lnk</linkerscript>
<bootstrap installbase="loader" /> <bootstrap installbase="loader" />
<library>freeldr_startup</library> <library>freeldr_startup</library>
<library>freeldr_base64k</library> <library>freeldr_base64k</library>
@ -15,8 +16,9 @@
<library>rtl</library> <library>rtl</library>
<library>libcntpr</library> <library>libcntpr</library>
<group linkerset="ld"> <group linkerset="ld">
<linkerflag>-nostartfiles</linkerflag> <!-- linkerflag>-nostartfiles</linkerflag -->
<linkerflag>-nostdlib</linkerflag> <!-- linkerflag>-nostdlib</linkerflag -->
<linkerflag>-lgcc</linkerflag> <!-- linkerflag>--strip-all</linkerflag -->
<linkerflag>-Tbss 0x50000</linkerflag>
</group> </group>
</module> </module>

View file

@ -5,7 +5,7 @@
#define PROPSHEETHEIGHT 228 #define PROPSHEETHEIGHT 228
#define PROPSHEETPADDING(x) (x+x+x+x+x+x) #define PROPSHEETPADDING(x) (x+x+x+x+x+x)
#define SYSTEM_COLUMN (18*PROPSHEETPADDING) #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 #define ICONSIZE 16

View file

@ -1,4 +1,4 @@
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
#pragma code_page(65001) #pragma code_page(65001)

View file

@ -1,4 +1,4 @@
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
#pragma code_page(65001) #pragma code_page(65001)

View file

@ -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 LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL

View file

@ -1,4 +1,4 @@
LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL
#pragma code_page(65001) #pragma code_page(65001)

View file

@ -11,6 +11,11 @@
<xi:include href="compbatt/compbatt.rbuild" /> <xi:include href="compbatt/compbatt.rbuild" />
</directory> </directory>
<if property="ARCH" value="i386">
<group compilerset="msc">
<define name="WIN32"/>
</group>
</if>
<module name="acpi" type="kernelmodedriver" installbase="system32/drivers" installname="acpi.sys" allowwarnings="true"> <module name="acpi" type="kernelmodedriver" installbase="system32/drivers" installname="acpi.sys" allowwarnings="true">
<bootstrap installbase="$(CDOUTPUT)" /> <bootstrap installbase="$(CDOUTPUT)" />

View file

@ -128,7 +128,7 @@ typedef unsigned char boolean;
(RpcExceptionCode() == RPC_X_BAD_STUB_DATA) || \ (RpcExceptionCode() == RPC_X_BAD_STUB_DATA) || \
(RpcExceptionCode() == RPC_S_INVALID_BOUND)) (RpcExceptionCode() == RPC_S_INVALID_BOUND))
typedef struct typedef struct tagNDR_SCONTEXT
{ {
void *pad[2]; void *pad[2];
void *userContext; void *userContext;

View file

@ -100,9 +100,9 @@ Abstract:
#define NTDDI_WIN7 0x06010000 #define NTDDI_WIN7 0x06010000
/* Version Fields in NTDDI_VERSION */ /* Version Fields in NTDDI_VERSION */
#define OSVERSION_MASK 0xFFFF0000 #define OSVERSION_MASK 0xFFFF0000UL
#define SPVERSION_MASK 0x0000FF00 #define SPVERSION_MASK 0x0000FF00UL
#define SUBVERSION_MASK 0x000000FF #define SUBVERSION_MASK 0x000000FFUL
/* Macros to Extract Version Fields From NTDDI_VERSION */ /* Macros to Extract Version Fields From NTDDI_VERSION */
#define OSVER(Version) ((Version) & OSVERSION_MASK) #define OSVER(Version) ((Version) & OSVERSION_MASK)

View file

@ -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

View file

@ -4,13 +4,14 @@
* No warranty is given; refer to the file DISCLAIMER.PD within this package. * 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 #define _ATTRIBUTES
#else #else
#define _ATTRIBUTES shared #define _ATTRIBUTES shared
#endif #endif
#if defined(_MSC_VER)
/* Reference list of existing section for msvcrt. */ /* Reference list of existing section for msvcrt. */
#pragma section(".CRTMP$XCA",long,_ATTRIBUTES) #pragma section(".CRTMP$XCA",long,_ATTRIBUTES)
#pragma section(".CRTMP$XCZ",long,_ATTRIBUTES) #pragma section(".CRTMP$XCZ",long,_ATTRIBUTES)
@ -55,14 +56,17 @@
#pragma section(".rtc$IZZ",long,read) #pragma section(".rtc$IZZ",long,read)
#pragma section(".rtc$TAA",long,read) #pragma section(".rtc$TAA",long,read)
#pragma section(".rtc$TZZ",long,read) #pragma section(".rtc$TZZ",long,read)
/* for tlssup.c: */
#pragma section(".tls",long,read,write) #pragma section(".tls",long,read,write)
#pragma section(".tls$AAA",long,read,write)
#pragma section(".tls$ZZZ",long,read,write) #pragma section(".tls$ZZZ",long,read,write)
#endif #endif /* _MSC_VER */
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define _CRTALLOC(x) __declspec(allocate(x)) #define _CRTALLOC(x) __declspec(allocate(x))
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define _CRTALLOC(x) __attribute__ ((section (x) )) #define _CRTALLOC(x) __attribute__ ((section (x) ))
#else #else
#error #error Your compiler is not supported.
#endif #endif

View file

@ -10,7 +10,7 @@
#define _WIN32_IE 0x0501 #define _WIN32_IE 0x0501
#endif #endif
#include_next <commctrl.h> #include <psdk/commctrl.h>
#undef DPA_GetPtr #undef DPA_GetPtr
LPVOID WINAPI DPA_GetPtr(HDPA, INT); LPVOID WINAPI DPA_GetPtr(HDPA, INT);

View file

@ -1,2 +1,2 @@
#include_next <compstui.h> #include <psdk/compstui.h>

View file

@ -1,2 +1,2 @@
#include_next <winddiui.h> #include <psdk/winddiui.h>

View file

@ -1,2 +1,2 @@
#include_next <winsplp.h> #include <psdk/winsplp.h>

View file

@ -9,14 +9,16 @@ void _fpreset (void);
void _fpreset (void) void _fpreset (void)
{ {
#ifdef __GNUC__ #ifdef __GNUC__
__asm__ ("fninit" ); __asm__ ("fninit");
#else #else /* msvc: */
__asm fninit; __asm fninit;
#endif #endif
} }
#ifdef __GNUC__ #ifdef __GNUC__
void __attribute__ ((alias ("_fpreset"))) fpreset(void); void __attribute__ ((alias ("_fpreset"))) fpreset(void);
#else #else
void fpreset(void) { _fpreset(); } void fpreset(void) {
_fpreset();
}
#endif #endif

View file

@ -17,5 +17,7 @@ void _fpreset (void)
#ifdef __GNUC__ #ifdef __GNUC__
void __attribute__ ((alias ("_fpreset"))) fpreset(void); void __attribute__ ((alias ("_fpreset"))) fpreset(void);
#else #else
void fpreset(void) { _fpreset(); } void fpreset(void) {
_fpreset();
}
#endif #endif

View file

@ -20,6 +20,7 @@
#include <tchar.h> #include <tchar.h>
#include <sect_attribs.h> #include <sect_attribs.h>
#include <locale.h> #include <locale.h>
#include <intrin.h>
#ifndef __winitenv #ifndef __winitenv
extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
@ -51,7 +52,11 @@ extern int * __MINGW_IMP_SYMBOL(_commode);
#define _commode (* __MINGW_IMP_SYMBOL(_commode)) #define _commode (* __MINGW_IMP_SYMBOL(_commode))
extern int _dowildcard; extern int _dowildcard;
#if defined(__GNUC__)
int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0; int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0;
#else
int _MINGW_INSTALL_DEBUG_MATHERR = 0;
#endif
extern int __defaultmatherr; extern int __defaultmatherr;
extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *); extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *);

View file

@ -88,19 +88,25 @@ __security_init_cookie (void)
__security_cookie_complement = ~cookie; __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);
__declspec(noreturn) void __cdecl __declspec(noreturn) void __cdecl
__report_gsfailure (ULONGLONG StackCookie) __report_gsfailure (ULONGLONG StackCookie)
{ {
volatile UINT_PTR cookie[2]; volatile UINT_PTR __UNUSED_PARAM(cookie[2]);
#ifdef _WIN64 #ifdef _WIN64
ULONG64 controlPC, imgBase, establisherFrame; ULONG64 controlPC, imgBase, establisherFrame;
PRUNTIME_FUNCTION fctEntry; PRUNTIME_FUNCTION fctEntry;
PVOID hndData; PVOID hndData;
#endif
#ifdef _WIN64
RtlCaptureContext (&GS_ContextRecord); RtlCaptureContext (&GS_ContextRecord);
controlPC = GS_ContextRecord.Rip; controlPC = GS_ContextRecord.Rip;
fctEntry = RtlLookupFunctionEntry (controlPC, &imgBase, NULL); fctEntry = RtlLookupFunctionEntry (controlPC, &imgBase, NULL);
@ -110,25 +116,15 @@ __report_gsfailure (ULONGLONG StackCookie)
&GS_ContextRecord, &hndData, &establisherFrame, NULL); &GS_ContextRecord, &hndData, &establisherFrame, NULL);
} }
else 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 #ifdef _WIN64
GS_ContextRecord.Rip = (ULONGLONG) _ReturnAddress(); GS_ContextRecord.Rip = (ULONGLONG) _ReturnAddress();
GS_ContextRecord.Rsp = (ULONGLONG) _AddressOfReturnAddress(); GS_ContextRecord.Rsp = (ULONGLONG) _AddressOfReturnAddress() + 8;
#else #else
GS_ContextRecord.Eip = (DWORD) _ReturnAddress(); GS_ContextRecord.Eip = (DWORD) _ReturnAddress();
GS_ContextRecord.Esp = (DWORD) _AddressOfReturnAddress(); GS_ContextRecord.Esp = (DWORD) _AddressOfReturnAddress() + 4;
#endif #endif /* _WIN64 */
#endif
} }
#ifdef _WIN64 #ifdef _WIN64
@ -137,7 +133,7 @@ __report_gsfailure (ULONGLONG StackCookie)
#else #else
GS_ExceptionRecord.ExceptionAddress = (PVOID) GS_ContextRecord.Eip; GS_ExceptionRecord.ExceptionAddress = (PVOID) GS_ContextRecord.Eip;
GS_ContextRecord.Ecx = StackCookie; GS_ContextRecord.Ecx = StackCookie;
#endif #endif /* _WIN64 */
GS_ExceptionRecord.ExceptionCode = STATUS_STACK_BUFFER_OVERRUN; GS_ExceptionRecord.ExceptionCode = STATUS_STACK_BUFFER_OVERRUN;
GS_ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE; GS_ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
cookie[0] = __security_cookie; cookie[0] = __security_cookie;
@ -147,3 +143,4 @@ __report_gsfailure (ULONGLONG StackCookie)
TerminateProcess (GetCurrentProcess (), STATUS_STACK_BUFFER_OVERRUN); TerminateProcess (GetCurrentProcess (), STATUS_STACK_BUFFER_OVERRUN);
abort(); abort();
} }

View file

@ -10,20 +10,25 @@
#undef CRTDLL #undef CRTDLL
#endif #endif
#include <sect_attribs.h>
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <memory.h> #include <memory.h>
#include <malloc.h> #include <malloc.h>
#ifndef _WIN64
#ifndef _CRTALLOC #include <stdlib.h> /* for _winmajor */
#define _CRTALLOC(x) __attribute__ ((section (x) ))
#endif #endif
#ifndef __INTERNAL_FUNC_DEFINED #ifndef __INTERNAL_FUNC_DEFINED
#define __INTERNAL_FUNC_DEFINED #define __INTERNAL_FUNC_DEFINED
typedef void (__cdecl *_PVFV)(void); typedef void (__cdecl *_PVFV)(void);
typedef int (__cdecl *_PIFV)(void); typedef int (__cdecl *_PIFV)(void);
typedef void (__cdecl *_PVFI)(int); typedef void (__cdecl *_PVFI)(int);
#endif #endif
extern WINBOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved); extern WINBOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved);
@ -209,5 +214,5 @@ _CRTALLOC(".CRT$XLD") PIMAGE_TLS_CALLBACK __xl_d = (PIMAGE_TLS_CALLBACK) __dyn_t
int mingw_initltsdrot_force = 0; int mingw_initltsdrot_force = 0;
int mingw_initltsdyn_force=0; int mingw_initltsdyn_force = 0;
int mingw_initltssuo_force = 0; int mingw_initltssuo_force = 0;

174
ntoskrnl/ntoskrnl_amd64.lnk Normal file
View file

@ -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)
}
}