[ASM x64] Make UNIMPLEMENTED macro self-suffisant

This fixes link errors with MsgUnimplemented not defined on binaries not linking to CRT.
This commit is contained in:
Hervé Poussineau 2021-01-10 07:46:25 +01:00
parent ae4ce99e00
commit c345f7f137
2 changed files with 12 additions and 14 deletions

View file

@ -246,6 +246,10 @@ ENDM
/* Macro values need to be marked */ /* Macro values need to be marked */
#define VAL(x) \x #define VAL(x) \x
#define CR "\r"
#define LF "\n"
#define NUL "\0"
/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ /* Due to MASM's reverse syntax, we are forced to use a precompiler macro */
#define MACRO(...) .macro __VA_ARGS__ #define MACRO(...) .macro __VA_ARGS__
#define ENDM .endm #define ENDM .endm
@ -383,14 +387,15 @@ code = 1
.endm .endm
.macro UNIMPLEMENTED2 file, line, func .macro UNIMPLEMENTED2 file, line, func
jmp 3f jmp 4f
1: .asciz "\func" 1: .ascii "Unimplemented", CR, LF, NUL
2: .asciz \file 2: .asciz "\func"
3: 3: .asciz \file
4:
sub rsp, 0x20 sub rsp, 0x20
lea rcx, MsgUnimplemented[rip] lea rcx, 1b[rip]
lea rdx, 1b[rip] lea rdx, 2b[rip]
lea r8, 2b[rip] lea r8, 3b[rip]
mov r9, \line mov r9, \line
call DbgPrint call DbgPrint
add rsp, 0x20 add rsp, 0x20
@ -404,10 +409,6 @@ code = 1
#define else .else #define else .else
#define elseif .elseif #define elseif .elseif
#define CR "\r"
#define LF "\n"
#define NUL "\0"
/* CFI annotations */ /* CFI annotations */
#define CFI_STARTPROC .cfi_startproc #define CFI_STARTPROC .cfi_startproc
#define CFI_ENDPROC .cfi_endproc #define CFI_ENDPROC .cfi_endproc

View file

@ -13,9 +13,6 @@
/* CODE **********************************************************************/ /* CODE **********************************************************************/
.code64 .code64
MsgUnimplemented:
.ascii "Unimplemented", CR, LF, NUL
FUNC __chkstk FUNC __chkstk
.endprolog .endprolog
UNIMPLEMENTED chkstk UNIMPLEMENTED chkstk