diff --git a/boot/freeldr/freeldr/freeldr_i386.msvc.lds b/boot/freeldr/freeldr/freeldr_i386.msvc.lds index bcfc19204e3b3..53e00ba8af3be 100644 --- a/boot/freeldr/freeldr/freeldr_i386.msvc.lds +++ b/boot/freeldr/freeldr/freeldr_i386.msvc.lds @@ -44,6 +44,47 @@ #include + +#ifdef _M_AMD64 +_TEXT SEGMENT 'CODE' + +/* +__declspec(noreturn) __forceinline +void __fastfail(unsigned int Code) // __cdecl +*/ +PUBLIC __fastfail +__fastfail: + +#ifdef _M_IX86 // _X86_ + push ebp + mov ebp, esp + mov ecx, [ebp+8/*Code*/] +#elif defined(_M_AMD64) + /* First argument already in rcx */ +#else +#error Unsupported architecture +#endif + + int HEX(29) + +/* Never return */ + cli +die: + hlt + jmp die + +#ifdef _M_IX86 // _X86_ + pop ebp +#elif !defined(_M_AMD64) +#error Unsupported architecture +#endif + ret + +_TEXT ENDS +#endif // _M_AMD64 + + + /* #pragma bss_seg(".bss") // __declspec(allocate(".bss")) diff --git a/sdk/include/asm/asm.inc b/sdk/include/asm/asm.inc index 7b3df60e6b127..0320b209d48d3 100644 --- a/sdk/include/asm/asm.inc +++ b/sdk/include/asm/asm.inc @@ -9,6 +9,9 @@ #ifndef __ASM_INC__ #define __ASM_INC__ +// /* Makes "x" a global variable or label */ +// #define EXTERN(x) .global x; x: + /* * Common definitions for the FPO macro. * See https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_fpo_data @@ -99,7 +102,9 @@ ENDM .code32 MACRO .code +#ifdef _M_IX86 .586P +#endif ENDM .code16 MACRO diff --git a/sdk/include/crt/msc/intrin.h b/sdk/include/crt/msc/intrin.h index 5fd3001917458..a1a8d9b6f1057 100644 --- a/sdk/include/crt/msc/intrin.h +++ b/sdk/include/crt/msc/intrin.h @@ -279,6 +279,7 @@ void __fastfail(unsigned int Code) } } #else +__declspec(noreturn) __forceinline void __fastfail(unsigned int Code); #endif // defined(_M_IX86) #endif @@ -356,6 +357,7 @@ void _sgdt(void *Destination) } } #else +__forceinline void _sgdt(void *Destination); #endif // defined(_M_IX86) #endif