解读《x64 deep dive》 2

本文详细介绍了X64架构的特点,包括寄存器使用、参数传递方式、内联展开、异常处理机制等,并探讨了这些特性如何影响调试过程。文章还特别提到了X64架构下特有的调试挑战及其解决方法。

1. All registers on the X64 CPU, with the exception of the segment registers and the EFlags register, are 64-bits which implies that all fetches from memory are 64-bit wide.

2. Fastcall is the default calling convention on X64 where in the first 4 parameters are passed via the registers RCX, RDX, R8, R9.

3. RBP is no longer used as frame pointer. It is now a general purpose register like any of the other registers like RBX, RCX etc. The debugger can no longer use the RBP register to walk the call stack.

4. The X64 compiler performs inline expansion of functions by which if certain criteria is met, it replaces the call to a function with the body of the callee. Although in-lining is not unique to X64, the X64 compiler is over zealous about in-lining functions. In-lining at a source file level is controlled by compiler's /Ob flag and in-lining can be disabled on a per function basis by __declspec(noinline).

5. X64 compiler can optimize the last call made from a function by replacing it with a jump to the callee. This avoids the overhead of setting up the stack frame for the callee.(哪些情况可以优化,需要进一步研究)

6. X64 uses the RSP register both as a stack pointer and a frame pointer(An exception to this rule are functions that use alloca() to dynamically allocate space on the stack. Such functions will use the RBP register as a frame pointer, as they did with EBP on the X86.)

7.all stack references on X64 are performed based on RSP. Due to this, functions on X64 depend on the RSP register being static throughout the function body, serving as a frame of reference for accessing locals and parameters.The fact that the stack pointer does not change at all between the prolog and the epilog is a characteristic feature of X64 functions,

8. In the x64 version of the function, however, there is no indication that the function uses structured exception handling, since no stack based exception frames are built at runtime.

9. On x86, when the high level language (C/C++) code contains structured exception handling constructs like __try/__except, the compiler generates special code in the prolog and epilog of the function that builds the exception frame on the stack at runtime.

10. When the function generates an exception, the OS scans the memory mapped copy of the PE file looking for a RUNTIME_FUNCTION structure whose extents include the current instruction address. The UnwindData field of the RUNTIME_FUNCTION structure contains the offset of another structure that tells the OS runtime as to how it should go about unwinding the stack, this is the UNWIND_INFO structure.

11. Other than this one issue with retrieving parameters, x64 debugging is not that different from x86 debugging.

12. Although the first four parameters are passed via registers, there is still space allocated on the stack for these four parameters. This is called the parameter homing space, The minimum size of this homing space is 0x20 bytes or four 64-bit slots, even if the function takes less than 4 parameters.When the homing space is not used to store parameter values, the compiler uses it to save non-volatile registers.

13. The register based parameter homing space exists only for non-leaf functions. It contains space for four parameters even if there isn't a single callee that takes that many parameters.

14. The value of the Child-SP register displayed by the debugger's "k" command represents the address at which the stack pointer (RSP) points to, as the point where the function displayed in that frame, has finished executing its prolog.

15. On the X86 CPU, the debugger follows the frame pointer (EBP) chain to walk the call stack from the most recent function frame to the least recent one

16. this frame pointer chain can be broken under certain circumstances, like when functions have their frame pointer omitted (FPO). In these cases, the debugger needs the symbols of the module to be able to accurately walk the call stack.

17. The debugger locates the RUNTIME_FUNCTION, UNWIND_INFO and UNWIND_CODE structures to compute the stack space utilization for every function in the call stack and adds these values to the Child-SPs to compute the value of subsequent Child-SPs.The UNWIND_CODE structures indicate the number of non-volatile registers that are pushed on the stack and the amount of space allocated for the locals and the parameters.

18. The debugger's "knf" command displays the call stack along with the amount of stack space utilized by every frame in the stack. This stack space utilization is listed under the "Memory" column.(需要注意的是,frame n占用的栈空间容量显示在frame n+1的Memory列中)。

19. Non-volatile registers that are moved (UWOP_SAVE_NONVOL), as opposed to pushed (UWOP_PUSH_NONVOL) on to the stack, don't contribute towards consumption of stack space.

内容概要:本文详细介绍了一个基于CNN-GRU与AdaBoost集成的深度学习模型在时间序列预测中的完整项目实现。该模型通过卷积神经网络(CNN)提取局部时空特征,利用门控循环单元(GRU)捕捉长期时序依赖,并结合AdaBoost自适应提升算法增强模型泛化能力与鲁棒性,有效应对非线性、噪声干扰和复杂动态变化的挑战。项目涵盖从数据生成、预处理、模型构建、训练优化到结果可视化和GUI交互界面开发的全流程,提供了完整的代码示例与模块化系统架构设计,支持金融、能源、交通、医疗等多个领域的高精度预测应用。; 适合人群:具备一定Python编程基础和机器学习知识,熟悉深度学习框架(如TensorFlow/Keras)的数据科学家、算法工程师及高校研究人员,尤其适合从事时间序列分析、智能预测系统开发的相关从业者。; 使用场景及目标:①实现高精度时间序列预测,如股票价格、电力负荷、交通流量等;②构建具备强鲁棒性和抗噪能力的工业级预测系统;③开发集成深度学习与集成学习的复合模型以提升预测稳定性;④通过GUI界面实现模型的便捷部署与交互式分析。; 阅读建议:建议读者结合文档中的代码逐步实践,重点关注数据预处理、模型集成机制与可视化模块的设计逻辑,同时可在不同数据集上进行迁移实验,深入理解CNN-GRU与AdaBoost协同工作的原理与优势。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值