le

所属分类:Windows编程
开发工具:Asm
文件大小:6KB
下载次数:2
上传日期:2013-12-02 14:00:57
上 传 者钱小小
说明:  该程序模拟UNIX中save与resume函数,并介绍在VC中如何使用汇编进行机器级的操作. 主函数很简单首先引入两个外部函数,extern \"C\"表示按传统C命名习惯.函数save将程序指针保存在(*s)中并返回0,为什么有   if(save(&sp)){...} if后的语句看起来永远都不会被执行,但是运行结果表明它被执行了.这个问题同UNIX中处理机调度函数(switch)的那个if语句(第一句)一样. 程序执行完save(&sp)后得到因为条件为假而执行else语句,却在判断之前将程序指针保存在sp中了. else语句中的resume(&sp),该函数很狡猾将堆栈中的返回地址改变了,改到了sp所指出,即将程序指针改到了执行条件判断前.resume返回1,条件满足,执行if语句.
(The program simulates UNIX, save and resume functions, and describes how to use the assembly in VC for machine-level operations. Primary function is very simple first introduced two external functions, extern \ " C \" represents the traditional C naming convention. Functions save The program pointer stored in (* s) and returns 0, why is there if (save (& sp)) {...} if statement looks after will never be executed, but the results show that it was executed. The problem with UNIX processor scheduling function (switch) that if statement (first sentence) the same. program execution to obtain complete save (& sp) because the condition is false after the else statement is executed, but before the judgment pointer stored in the program sp in the. else statement resume (& sp), this function is very tricky to stack the return address has changed, changed to the sp has pointed out, the upcoming program pointer changes to the implementation of conditional ago. resume returns 1)

文件列表:
UnixC (0, 2003-05-22)
UnixC\unix.asm (575, 2003-05-17)
UnixC\UNIX.OBJ (208, 2003-05-17)
UnixC\UnixC.cpp (335, 2003-05-22)
UnixC\UnixC.dsp (3426, 2003-05-22)
UnixC\UnixC.dsw (535, 2003-05-22)
UnixC\UnixC.opt (48640, 2003-05-22)
UnixC\说明.txt (777, 2003-05-17)

近期下载者

相关文件


收藏者