在什么情况下我需要为x86-64汇编功能设置SEH展开信息? [英] Under what conditions do I need to set up SEH unwind info for an x86-64 assembly function?

查看:94
本文介绍了在什么情况下我需要为x86-64汇编功能设置SEH展开信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

64位Windows ABI定义了一种通用的例外处理机制,我认为即使在其他语言(例如C)中,C ++异常和可用的结构化异常也可以共享这些信息.

The 64-bit Windows ABI defines a generalized exception handling mechanism, which I believe is shared across C++ exceptions and structured exceptions available even in other languages such as C.

如果我正在编写要在nasm中编译并链接到C或C ++库的x86-64汇编例程,那么在生成展开信息等方面我需要在Windows上进行哪些调节?

If I'm writing an x86-64 assembly routine to be compiled in nasm and linked into a C or C++ library, what accommodations do I need make on Windows in terms of generating unwind info and so on?

我不打算直接在汇编代码中生成任何异常,尽管我认为如果用户提供的缓冲区无效,则该代码可能会出现访问冲突.

I'm not planning on generating any exceptions directly in the assembly code, although I suppose it is possible that the code may get an access violation if a user-supplied buffer is invalid, etc.

我希望写出尽可能少的代码来使它起作用,尤其是因为似乎nasm对生成展开信息的支持不佳,并且对于跨平台项目,使用MASM并不是一种选择.我确实需要使用(因此保存和恢复)非易失性寄存器.

I'd like the write the minimum possible to get this to work, especially since it seems that nasm has poor support for generating unwind info and using MASM is not an option for this cross-platform project. I do need to use (hence save and restore) non-volatile registers.

推荐答案

通常,Windows x64需要 all 函数来提供展开信息.唯一的例外是不修改rsp且不修改任何非易失性寄存器的叶子函数.

As a general rule, Windows x64 requires all functions to provide unwind information. The only exception is for leaf functions which do not modify rsp and do not modify any nonvolatile registers.

这篇关于在什么情况下我需要为x86-64汇编功能设置SEH展开信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆