]> granicus.if.org Git - yasm/commit
Add support for Win64 structured exception handling (aka .xdata and .pdata).
authorPeter Johnson <peter@tortall.net>
Mon, 12 Feb 2007 03:48:53 +0000 (03:48 -0000)
committerPeter Johnson <peter@tortall.net>
Mon, 12 Feb 2007 03:48:53 +0000 (03:48 -0000)
commitef6fd9c8c04aa3276fdd4d9b4e98e39ad1854ea6
treef3e584a5f4f206b88eed7708fd7c13fd3a2dfbd3
parent1e76ae89cb306c135891622aa3bcc61a59c267d5
Add support for Win64 structured exception handling (aka .xdata and .pdata).

Requested by: Myria Chan, Brian Gladman, several others
Helped by: Brian Gladman (format documentation pointers)

This commit adds the necessary directives and some higher-level macros to
make it easier to generate the .xdata and .pdata sections needed for
structured exception handling on Win64.  The overall construction mirrors
MASM very closely, so it should be possible for near-direct translation of
MASM code to Yasm; see for example objfmts/win64/tests/sce3.masm and
objfmts/win64/tests/sce4.asm.  This commit does *not* break generating these
yourself (which you may want to do if you're a compiler).

This commit adds special proc macros so the function layout will look like:

proc_frame <procname>
... (frame setup and unwind directives)
end_prologue (or alternatively [endprolog])
...
endproc_frame

The "raw pseudo operations" (.directives) as described in MSDN
(http://msdn2.microsoft.com/en-us/library/ms235231(VS.80).aspx)
have been exactly mirrored in Yasm, as follows:
[pushreg], [setframe], [allocstack], [savereg], [savexmm128], [pushframe],
[endprolog]

Note the [] are required.

Additionally, the following macros have been implemented that MASM provides
in ksamd64.inc, and as documented in MSDN
(http://msdn2.microsoft.com/en-us/library/ms235217(VS.80).aspx):
push_reg, rex_push_reg, push_eflags, rex_push_eflags, alloc_stack,
save_reg, save_xmm128, push_frame, set_frame, end_prologue

I'll next work on getting all of this documented in the user manual.

svn path=/trunk/yasm/; revision=1762
27 files changed:
Mkfiles/Makefile.dj
Mkfiles/Makefile.flat
Mkfiles/vc/modules/modules.vcproj
Mkfiles/vc8/modules/modules.vcproj
modules/objfmts/coff/Makefile.inc
modules/objfmts/coff/coff-objfmt.c
modules/objfmts/coff/coff-objfmt.h [new file with mode: 0644]
modules/objfmts/coff/win64-except.c [new file with mode: 0644]
modules/objfmts/win64/tests/Makefile.inc
modules/objfmts/win64/tests/sce1-err.asm [new file with mode: 0644]
modules/objfmts/win64/tests/sce1-err.errwarn [new file with mode: 0644]
modules/objfmts/win64/tests/sce1.asm [new file with mode: 0644]
modules/objfmts/win64/tests/sce1.hex [new file with mode: 0644]
modules/objfmts/win64/tests/sce2-err.asm [new file with mode: 0644]
modules/objfmts/win64/tests/sce2-err.errwarn [new file with mode: 0644]
modules/objfmts/win64/tests/sce2.asm [new file with mode: 0644]
modules/objfmts/win64/tests/sce2.hex [new file with mode: 0644]
modules/objfmts/win64/tests/sce3.asm [new file with mode: 0644]
modules/objfmts/win64/tests/sce3.hex [new file with mode: 0644]
modules/objfmts/win64/tests/sce3.masm [new file with mode: 0644]
modules/objfmts/win64/tests/sce4-err.asm [new file with mode: 0644]
modules/objfmts/win64/tests/sce4-err.errwarn [new file with mode: 0644]
modules/objfmts/win64/tests/sce4.asm [new file with mode: 0644]
modules/objfmts/win64/tests/sce4.hex [new file with mode: 0644]
modules/objfmts/win64/tests/sce4.masm [new file with mode: 0644]
modules/preprocs/nasm/standard.mac
po/POTFILES.in